添加WordPress编辑器

问题描述 投票:1回答:1

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

$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 );

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

enter image description here

wordpress wordpress-theming
1个回答
0
投票

您可以尝试这样的事情:

/**
 * 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' );

我并没有真正测试过,但是应该遵循这些思路。同样,由于默认将TinyMCE编辑器删除了,因此,您可能需要获取Classic Editor插件。也未测试。

© www.soinside.com 2019 - 2024. All rights reserved.