您也可以将一些设置变量传递给编辑器。如果不传递它,它将采用默认值。
我注意到的另一件事是,如果我exit();
在加载页脚之前在页面中的任何位置执行此操作,它不会在工具栏中显示任何按钮,因为它会从页脚加载一些脚本。因此,如果您有exit()
或die()
之前加载页脚,它将不会加载工具栏。
在这里,我已将它传递给我的编辑器,并且工作正常。
define('WP_USE_THEMES', false);
require('wp-blog-header.php');
$editor_id = 'mycustomeditor';
$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' => '', // extra styles for both visual and HTML editors buttons,
'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()
);
wp_editor( "My content", $editor_id, $settings );