【亲测有效】wordpress分类描述怎么加上默认自带的编辑器

废话不多说,直接上代码

/*
* 作者:王牌开发
* 网址: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
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值