wp_editor() WordPress Function

The wp_editor() function is used to create a WordPress editor. It allows you to add, edit, and delete posts and pages. You can also use it to manage your comments and settings.

wp_editor( string $content, string $editor_id, array $settings = array() ) #

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.

Top ↑

See also


Top ↑

Parameters

$content

(string)(Required)Initial content for the editor.

$editor_id

(string)(Required)HTML ID attribute value for the textarea and TinyMCE. Should not contain square brackets.

$settings

(array)(Optional)See _WP_Editors::parse_settings() for description.

Default value: array()


Top ↑

Source

File: wp-includes/general-template.php

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 );
}


Top ↑

Changelog

Changelog
VersionDescription
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More