wpcf7_flamingo_update_channel()CF7 1.0

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wpcf7_flamingo_update_channel( $contact_form );
$contact_form (обязательный)
-

Код wpcf7_flamingo_update_channel() CF7 5.9.3

function wpcf7_flamingo_update_channel( $contact_form ) {
	if ( ! class_exists( 'Flamingo_Inbound_Message' ) ) {
		return false;
	}

	$post_meta = get_post_meta( $contact_form->id(), '_flamingo', true );

	$channel = isset( $post_meta['channel'] )
		? get_term( $post_meta['channel'],
				Flamingo_Inbound_Message::channel_taxonomy
			)
		: get_term_by( 'slug', $contact_form->name(),
				Flamingo_Inbound_Message::channel_taxonomy
			);

	if ( ! $channel or is_wp_error( $channel ) ) {
		return;
	}

	if ( $channel->name !== wp_unslash( $contact_form->title() ) ) {
		wp_update_term( $channel->term_id,
			Flamingo_Inbound_Message::channel_taxonomy,
			array(
				'name' => $contact_form->title(),
				'slug' => $contact_form->name(),
				'parent' => $channel->parent,
			)
		);
	}
}