/**

    *WordPress 在分类设置页使用 TinyMCE 富文本编辑器

    *https://www.weixiaoduo.com/category-form-tinymce/

*/

functionBing_cat_description($tag){

?>

    <table class=“form-table”>

        <tr class=“form-field”>

            <th scope=“row”valign=“top”><label for=“description”><?php_ex(‘Description’,‘Taxonomy Description’);?></label></th>

            <td>

                <?php

                $settings=array(‘wpautop’=>true,‘media_buttons’=>true,‘quicktags’=>true,‘textarea_rows’=>’15’,‘textarea_name’=>‘description’);

                wp_editor(wp_kses_post($tag->description,ENT_QUOTES,‘UTF-8’),‘cat_description’,$settings);

                ?>

            <br/>

            <span class=“description”><?php_e(‘The description is not prominent by default; however, some themes may show it.’);?></span>

            </td>

        </tr>

    </table>

<?php

}

add_filter(‘edit_category_form_fields’,‘Bing_cat_description’);

//移除默认的纯文本描述表单

functionBing_remove_default_category_description(){

    global$current_screen;

    if($current_screen->id==‘edit-category’){

?>

    <script type=“text/javascript”>

    jQuery(function($){

        $(‘textarea#description’).closest(‘tr.form-field’).remove();

    });

    </script>

<?php

    }

}

add_action(‘admin_head’,‘Bing_remove_default_category_description’);

//移除过滤 Html

remove_filter(‘pre_term_description’,‘wp_filter_kses’);

remove_filter(‘term_description’,‘wp_kses_data’);