WP编辑器不能在WordPress的前端工作

时间:2016-04-15 09:24:57

标签: php wordpress editor

我正在尝试在前端嵌入wp编辑器,但在更新WordPress 4.5,最新版本后无法正常工作,

$settings = array(
    'wpautop' => true,
    'postContent' => 'content',
    'media_buttons' => false,
    'tinymce' => array(
    'theme_advanced_buttons1' => 'bold,italic,underline,blockquote,separator,strikethrough,bullist,numlist,justifyleft,justifycenter,justifyright,undo,redo,link,unlink,fullscreen',

    'theme_advanced_buttons2' => 'pastetext,pasteword,removeformat,|,charmap,|,outdent,indent,|,undo,redo',

    'theme_advanced_buttons3' => '',

    'theme_advanced_buttons4' => ''
    ),

    'quicktags' => array(
        'buttons' => 'b,i,ul,ol,li,link,close'
    )
);
wp_editor( $postContent, 'postContent', $settings );

输出注释。

2 个答案:

答案 0 :(得分:0)

我已经在WordPress.org上创建了一张错误票:https://core.trac.wordpress.org/ticket/36802

请将您可能拥有的任何其他信息添加到该票证中。

答案 1 :(得分:0)

我认为你需要在你的esttings中定义'textarea_name'字段 下面是wp_editor函数所需的所有设置     wp_editor($ content,$ editor_id,$ settings = array());

// default settings
$settings = array(
'wpautop' => true, // use wpautop?
'media_buttons' => true, // show insert/upload button(s)
'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..."
'tabindex' => '',
'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the <style> tags, can use "scoped".
'editor_class' => '', // add extra class(es) to the editor textarea
'teeny' => false, // output the minimal editor config used in Press This
'dfw' => false, // replace the default fullscreen with DFW (supported on the front-end in WordPress 3.4)
'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
);
相关问题