废话不多说,直接上代码
/*
* 作者:王牌开发
* 网址:WPKF.CN
*/
remove_filter('pre_term_description', 'wp_filter_kses');
remove_filter('term_description', 'wp_kses_data');
add_action("category_edit_form_fields", 'edit_form_fields_example', 10, 2);
add_action("category_add_form_fields", 'add_form_fields_example', 10, 2);
add_action("post_tag_edit_form_fields", 'edit_form_fields_example', 10, 2);
add_action("post_tag_add_form_fields", 'add_form_fields_example', 10, 2);
function edit_form_fields_example($term)
{
?>
<tr valign="top">
<th scope="row"><?php _e('Description'); ?></th>
<td>
<?php
$settings = array('wpautop' => true, 'media_buttons' => true, 'quicktags' => true, 'textarea_rows' => '5', 'textarea_name' => 'description');
wp_editor(wp_kses_post($term->description, ENT_QUOTES, 'UTF-8'), 'tag_description', $settings);
?>
<br />
<span class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></span>
<script>
jQuery(window).ready(function() {
jQuery('label[for=description]').parent().parent().remove();
});
</script>
</td>
</tr>
<?php
}
function add_form_fields_example()
{
?>
<tr valign="top">
<th scope="row"><?php _e('Description'); ?></th>
<td>
<?php wp_editor('', 'description', array('wpautop' => true, 'default_editor' => 'html', 'quicktags' => true)); ?>
<script>
jQuery(window).ready(function() {
jQuery('label[for=tag-description]').parent().remove();
});
</script>
</td>
</tr>
<?php
}