Renders an editor.
Description
Using this function is the proper way to output all needed components for both TinyMCE and Quicktags.
_WP_Editors should not be used directly. See https://core.trac.wordpress.org/ticket/17144.
NOTE: Once initialized the TinyMCE editor cannot be safely moved in the DOM. For that reason running wp_editor() inside of a meta box is not a good idea unless only Quicktags is used.
On the post edit screen several actions can be used to include additional editors containing TinyMCE: ‘edit_page_form’, ‘edit_form_advanced’ and ‘dbx_post_sidebar’.
See https://core.trac.wordpress.org/ticket/19173 for more information.
See also
Parameters
$contentstringrequired- Initial content for the editor.
$editor_idstringrequired- HTML ID attribute value for the textarea and TinyMCE.
Should not contain square brackets. $settingsarrayoptional- See _WP_Editors::parse_settings() for description.
Default:
array()
Source
function wp_editor( $content, $editor_id, $settings = array() ) {
if ( ! class_exists( '_WP_Editors', false ) ) {
require ABSPATH . WPINC . '/class-wp-editor.php';
}
_WP_Editors::editor( $content, $editor_id, $settings );
}
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |
Get the wp_editor through AJAX Call,
To edit tinymce Visual Buttons, you should use
toolbarinstead of TinyMCE documentation’stheme_advanced_buttonsattribute:The $settings array is actually described on the [_WP_Editors::parse_settings()](https://developer.wordpress.org/reference/classes/_wp_editors/parse_settings/) method
Modify the editor’s default settings when initializing it
You can pass an array of one or more settings to modify for this editor instance, such as hiding the insert media buttons.
Display an empty editor using the default settings
Fill an editor with the content for a particular post
Remove HTML button and media button in editor. Create blank content. Define a custom name and id for the editor. Determine your editor’s row count.