wpcf7_flamingo_add_channel()
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wpcf7_flamingo_add_channel( $slug, $name );
- $slug (обязательный)
- -
- $name **
- -
По умолчанию: ''
Код wpcf7_flamingo_add_channel() wpcf7 flamingo add channel CF7 5.9.3
function wpcf7_flamingo_add_channel( $slug, $name = '' ) { if ( ! class_exists( 'Flamingo_Inbound_Message' ) ) { return false; } $parent = term_exists( 'contact-form-7', Flamingo_Inbound_Message::channel_taxonomy ); if ( ! $parent ) { $parent = wp_insert_term( __( 'Contact Form 7', 'contact-form-7' ), Flamingo_Inbound_Message::channel_taxonomy, array( 'slug' => 'contact-form-7' ) ); if ( is_wp_error( $parent ) ) { return false; } } $parent = (int) $parent['term_id']; if ( ! is_taxonomy_hierarchical( Flamingo_Inbound_Message::channel_taxonomy ) ) { // backward compat for Flamingo 1.0.4 and lower return $parent; } if ( empty( $name ) ) { $name = $slug; } $channel = term_exists( $slug, Flamingo_Inbound_Message::channel_taxonomy, $parent ); if ( ! $channel ) { $channel = wp_insert_term( $name, Flamingo_Inbound_Message::channel_taxonomy, array( 'slug' => $slug, 'parent' => $parent ) ); if ( is_wp_error( $channel ) ) { return false; } } return (int) $channel['term_id']; }