wordpress – 将wp_editor添加到自定义WP小部件

我想将带有TinyMCE的WP编辑器添加到我的自定义文本小部件中,但它不会显示TinyMCE按钮,它只显示textarea.当我在page.php上测试我的代码时,它运行得很好 – 编辑器显示所有按钮和元数据箱.你能告诉我我做错了什么吗?EDIT
Widgets screenshot.
Same code used in page.php screenshot

我使用的代码:

$settings = array(
    'wpautop' => true,
    'media_buttons' =>  false,
    'textarea_name' => 'test-editor',
    'textarea_rows' => get_option('default_post_edit_rows', 10),
    'tabindex' => '',
    'editor_css' => '',
    'editor_class' => '',
    'teeny' => true,
    'dfw' => true,
    'tinymce' => array(
          'theme_advanced_buttons1' => 'bold,italic,underline' 
    ),
    'quicktags' => false
);
wp_editor( 'Text in editor', 'test-editor', $settings );

最佳答案 看起来你需要找到另一个WYSIWYG编辑器.
Reading the Codex,您的代码有两个问题:

> $editor_id

can only be composed of lower-case letters. No underscores, no hyphens. Anything else will cause the WYSIWYG editor to malfunction.

>这个阻止编辑器在元框中工作的那个

Once instantiated, the WYSIWYG editor cannot be moved around in the DOM. What this means in practical terms, is that you cannot put it in meta-boxes that can be dragged and placed elsewhere on the page.

点赞