I am using the *_add_form_fields
action to add fields to a custom taxonomy. One of those fields is a wp_editor().
The problem I am facing is that when I output the WordPress editor on the page like so:
wp_editor('test', 'mydescription', array('textarea_name' => 'my_description'));
and then if I click in the editor on the page and change the default value from test
to something else
the $_POST['my_description']
variable is still set to test
Should I be adding an additional setting to my editor? Is there a reason why I cannot change the value of the textarea?
EDIT
Below is a very simple test case that shows this happening. Place this in your functions.php file and then create a new tag. The posted value for 'my_description" will not change.
class Test{
function __construct() {
add_action('add_tag_form_fields', array($this, 'add_tag_form_fields'));
add_action('created_term', array($this, 'created_term'));
}
function add_tag_form_fields($tag){
if ( current_user_can( 'publish_posts' ) ): ?>
<div class="form-field">
<?php wp_editor('test', 'mydescription', array('textarea_name' => 'my_description')); ?>
</div>
<?php
}
function created_term($tag){
echo '<pre>';
print_r($_POST);
echo '</pre>';
die();
}
}
new Test();
EDIT
This ONLY happens when attaching to "created_term" action. If you attach to "edited_terms" it works as expected and I think this is a result of ajax being used on the create term page... I have updated the test code to show this.
Array ( [action] => add-tag [screen] => edit-post_tag [taxonomy] => post_tag [post_type] => post [_wpnonce_add-tag] => 4f7d3df228 [_wp_http_referer] => /wp-admin/edit-tags.php?taxonomy=post_tag [tag-name] => Test99 [slug] => [description] => [my_description] => something else )
, maybe something else in your code a problem?