【问题标题】:WP Editor not working at front end in WordPressWP 编辑器无法在 WordPress 的前端工作
【发布时间】:2016-04-15 09:24:57
【问题描述】:

我正在尝试在前端嵌入 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 );

输出注释。

【问题讨论】:

  • 您是否为true 启用了WP_DEBUG 标志来检查错误?
  • @Milap 感谢您的评论,是的,已经这样做了,但没有显示错误。
  • 任何 javascript 错误?请检查js控制台。

标签: php wordpress editor


【解决方案1】:

我已经在 WordPress.org 上发起了一个 bug 票:https://core.trac.wordpress.org/ticket/36802

请在该票证中添加您可能需要的任何其他信息。

【讨论】:

    【解决方案2】:

    我认为您需要在评估中定义“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()
    );
    

    【讨论】:

      猜你喜欢
      • 2018-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-14
      • 2019-02-12
      • 1970-01-01
      • 2014-12-13
      • 1970-01-01
      相关资源
      最近更新 更多