wp_editor() – Function | Developer.WordPress.org (original) (raw)

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

Default:array()

Source

function wp_editor( <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mi>o</mi><mi>n</mi><mi>t</mi><mi>e</mi><mi>n</mi><mi>t</mi><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">content, </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8095em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">co</span><span class="mord mathnormal">n</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span><span class="mord mathnormal">t</span><span class="mpunct">,</span></span></span></span>editor_id, $settings = array() ) {
    if ( ! class_exists( '_WP_Editors', false ) ) {
        require ABSPATH . WPINC . '/class-wp-editor.php';
    }
    _WP_Editors::editor( <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mi>o</mi><mi>n</mi><mi>t</mi><mi>e</mi><mi>n</mi><mi>t</mi><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">content, </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8095em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">co</span><span class="mord mathnormal">n</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span><span class="mord mathnormal">t</span><span class="mpunct">,</span></span></span></span>editor_id, $settings );
}

View all references View on Trac View on GitHub

Changelog

Version Description
3.3.0 Introduced.