Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
279 views
in Technique[技术] by (71.8m points)

wordpress - 添加WordPress编辑器(add WordPress editor)

This is how I add custom taxonomy

(这就是我添加自定义分类法的方式)

$args = array(
    'labels'                     => $labels,
    'hierarchical'               => true,
    'public'                     => true,
    'show_ui'                    => true,
    'show_admin_column'          => true,
    'show_in_nav_menus'          => true,
    'show_tagcloud'              => true,
    'supports' => array( 'editor', 'thumbnail')
);
register_taxonomy( 'bookwriters', 'product', $args );

I want add WordPress editor on description how i can do that ?

(我想在说明中添加WordPress编辑器我该怎么做?)

在此处输入图片说明

  ask by Shakil Hossain translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you can try something like this :

(您可以尝试这样的事情:)

/**
 * TinyMCE editor in taxonomy page
 */
function o99__category_editor() {
    global $pagenow, $current_screen;

    if( $pagenow == 'edit-tags.php' ) {
        require_once(ABSPATH . 'wp-admin/includes/post.php'); // we need these
        require_once(ABSPATH . 'wp-admin/includes/template.php');

        wp_tiny_mce( false, array( 'editor_selector' => 'description', 'elements' => 'description', 'mode' => 'exact' )); // first argument TRUE will give the light version
    } 
}
add_action( 'init', 'o99__category_editor' );

I did not really tested it, but something along these lines should work.

(我没有真正测试过它,但是应该遵循这些思路。)

Also since the TinyMCE editor was dropped as default, , you might need to get the Classic Editor plugin.

(同样,由于默认将TinyMCE编辑器删除了,因此,您可能需要获取Classic Editor插件。)

Also not tested.

(也没有测试。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...