wp_editor doesn't work in taxonomy add page
-
I have added a custom field in taxonomy create page.
$settings = array('wpautop' => true, 'media_buttons' => false, 'quicktags' => true, 'textarea_rows' => '15', 'textarea_name' => 'term_meta[product_long_desc]', 'teeny' => true ); wp_editor(wp_kses_post($term_meta['product_long_desc'] , ENT_QUOTES, 'UTF-8'), 'product_long_desc', $settings);
The problem is when I first add a category then the long description doesn’t work.But when I click the category and edit the long description from category edit page then it works.
add_action( 'created_product_cat', 'save_taxonomy_custom_meta', 10, 2 ); add_action( 'edited_product_cat', 'save_taxonomy_custom_meta', 10, 2 ); function save_taxonomy_custom_meta( $term_id ) { if ( isset( $_POST['term_meta'] ) ) { $t_id = $term_id; $term_meta = get_option( "taxonomy_$t_id" ); $cat_keys = array_keys( $_POST['term_meta'] ); foreach ( $cat_keys as $key ) { if ( isset ( $_POST['term_meta'][$key] ) ) { $term_meta[$key] = $_POST['term_meta'][$key]; } } // Save the option array. update_option( "taxonomy_$t_id", $term_meta ); } }
My wordpress version is 4.2.2. I checked that the value of product_long_desc
is empty in post. If I use a normal text area then it works.I can’t track where the problem is. The same code works in category edit page but not from the addition page.
Any help is highly appreciated. Thanks in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘wp_editor doesn't work in taxonomy add page’ is closed to new replies.