In your edited_terms
function you need to save the value and in your add_tag_form_fields
you need replace your test with the saved data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | class Test{ function __construct() { //do_action('add_tag_form_fields', $taxonomy); add_action('add_tag_form_fields', array($this, 'add_tag_form_fields')); //do_action("edited_terms", $term_id, $tt_id, $taxonomy); add_action('edited_terms', array($this, 'edited_terms')); } function add_tag_form_fields($term){ if ( current_user_can( 'publish_posts' ) ): ?> <div class="form-field"> <?php $saved = get_option('termmeta_'.$term->term_id); $saved = (empty($saved))? 'test': $saved; wp_editor($saved, 'mydescription', array('textarea_name' => 'my_description')); ?> </div> <?php } function edited_terms($term_id){ if (isset($_POST['mydescription'])){ update_option('termmeta_'.$term_id,$_POST['mydescription']); } } } new Test(); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.