{"id":5605,"date":"2026-02-12T20:44:54","date_gmt":"2026-02-13T01:44:54","guid":{"rendered":"https:\/\/chubes.net\/?documentation=editor-functions-reference"},"modified":"2026-03-13T03:28:20","modified_gmt":"2026-03-13T07:28:20","slug":"editor-functions-reference","status":"publish","type":"documentation","link":"https:\/\/chubes.net\/docs\/wordpress-core\/editor\/editor-functions-reference\/","title":{"rendered":"Editor Functions Reference"},"content":{"rendered":"<p>Public functions for working with the WordPress Classic Editor (TinyMCE and Quicktags).<\/p><p><strong>File:<\/strong> <code>wp-includes\/general-template.php<\/code> (primary)<br \/>\n<strong>Additional:<\/strong> <code>wp-includes\/formatting.php<\/code>, <code>wp-includes\/theme.php<\/code><\/p><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">wp_editor()<\/h2><p>Renders a TinyMCE\/Quicktags editor instance.<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function wp_editor( string $content, string $editor_id, array $settings = array() ): void<\/code><\/pre><\/div><p><strong>Parameters:<\/strong><\/p><figure class=\"wp-block-table\"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>$content<\/code><\/td><td>string<\/td><td>Initial content for the editor<\/td><\/tr><tr><td><code>$editor_id<\/code><\/td><td>string<\/td><td>HTML ID for the textarea. Should not contain square brackets.<\/td><\/tr><tr><td><code>$settings<\/code><\/td><td>array<\/td><td>Editor configuration (see Settings below)<\/td><\/tr><\/tbody><\/table><\/figure><p><strong>Settings:<\/strong><\/p><figure class=\"wp-block-table\"><table><thead><tr><th>Key<\/th><th>Type<\/th><th>Default<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>wpautop<\/code><\/td><td>bool<\/td><td><code>true<\/code><\/td><td>Whether to use <code>wpautop()<\/code> for paragraphs<\/td><\/tr><tr><td><code>media_buttons<\/code><\/td><td>bool<\/td><td><code>true<\/code><\/td><td>Show the Add Media button<\/td><\/tr><tr><td><code>default_editor<\/code><\/td><td>string<\/td><td><code>''<\/code><\/td><td>Default tab: <code>'tinymce'<\/code> or <code>'html'<\/code><\/td><\/tr><tr><td><code>drag_drop_upload<\/code><\/td><td>bool<\/td><td><code>false<\/code><\/td><td>Enable drag &amp; drop uploading<\/td><\/tr><tr><td><code>textarea_name<\/code><\/td><td>string<\/td><td><code>$editor_id<\/code><\/td><td>Name attribute for the textarea<\/td><\/tr><tr><td><code>textarea_rows<\/code><\/td><td>int<\/td><td><code>20<\/code><\/td><td>Number of textarea rows<\/td><\/tr><tr><td><code>tabindex<\/code><\/td><td>string\/int<\/td><td><code>''<\/code><\/td><td>Tabindex value<\/td><\/tr><tr><td><code>tabfocus_elements<\/code><\/td><td>string<\/td><td><code>':prev,:next'<\/code><\/td><td>Elements for Tab key navigation<\/td><\/tr><tr><td><code>editor_css<\/code><\/td><td>string<\/td><td><code>''<\/code><\/td><td>Extra CSS (include <code>&lt;style&gt;<\/code> tags)<\/td><\/tr><tr><td><code>editor_class<\/code><\/td><td>string<\/td><td><code>''<\/code><\/td><td>Extra CSS classes for textarea<\/td><\/tr><tr><td><code>teeny<\/code><\/td><td>bool<\/td><td><code>false<\/code><\/td><td>Use minimal editor (like Press This)<\/td><\/tr><tr><td><code>tinymce<\/code><\/td><td>bool\/array<\/td><td><code>true<\/code><\/td><td>Load TinyMCE, or array of settings<\/td><\/tr><tr><td><code>quicktags<\/code><\/td><td>bool\/array<\/td><td><code>true<\/code><\/td><td>Load Quicktags, or array of settings<\/td><\/tr><\/tbody><\/table><\/figure><p><strong>Since:<\/strong> 3.3.0<\/p><p><strong>Example &#8211; Basic Usage:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">$content = get_post_meta( $post_id, &#039;_my_content&#039;, true );\nwp_editor( $content, &#039;my_custom_editor&#039; );<\/code><\/pre><\/div><p><strong>Example &#8211; With Settings:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">wp_editor( $content, &#039;my_editor&#039;, array(\n    &#039;textarea_name&#039; =&gt; &#039;my_meta_field&#039;,\n    &#039;textarea_rows&#039; =&gt; 10,\n    &#039;media_buttons&#039; =&gt; false,\n    &#039;teeny&#039;         =&gt; true,\n    &#039;quicktags&#039;     =&gt; array(\n        &#039;buttons&#039; =&gt; &#039;strong,em,link,ul,ol,li,code&#039;,\n    ),\n) );<\/code><\/pre><\/div><p><strong>Example &#8211; TinyMCE Only:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">wp_editor( $content, &#039;visual_only&#039;, array(\n    &#039;quicktags&#039; =&gt; false,\n    &#039;tinymce&#039;   =&gt; array(\n        &#039;toolbar1&#039; =&gt; &#039;bold,italic,link,unlink&#039;,\n        &#039;toolbar2&#039; =&gt; &#039;&#039;,\n    ),\n) );<\/code><\/pre><\/div><p><strong>Example &#8211; Quicktags Only:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">wp_editor( $content, &#039;code_only&#039;, array(\n    &#039;tinymce&#039;   =&gt; false,\n    &#039;quicktags&#039; =&gt; array(\n        &#039;buttons&#039; =&gt; &#039;strong,em,link,code&#039;,\n    ),\n) );<\/code><\/pre><\/div><p><strong>Notes:<\/strong><\/p><ul class=\"wp-block-list\"><li>TinyMCE cannot be safely moved in the DOM after initialization<\/li><li>Don&#8217;t use inside meta boxes with TinyMCE; use <code>edit_form_advanced<\/code> action instead<\/li><li>Editor IDs with square brackets are deprecated (since 3.9.0)<\/li><\/ul><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">wp_enqueue_editor()<\/h2><p>Enqueue editor scripts and styles for late initialization.<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function wp_enqueue_editor(): void<\/code><\/pre><\/div><p><strong>Since:<\/strong> 4.8.0<\/p><p><strong>Description:<\/strong><\/p><p>Use this when you need to initialize the editor after the page has loaded. Call during <code>wp_enqueue_scripts<\/code> or <code>admin_enqueue_scripts<\/code>.<\/p><p>After enqueueing, use <code>wp.editor.initialize()<\/code> in JavaScript to create instances.<\/p><p><strong>Example:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">\/\/ PHP: Enqueue the editor\nadd_action( &#039;wp_enqueue_scripts&#039;, function() {\n    if ( is_page( &#039;contact&#039; ) ) {\n        wp_enqueue_editor();\n    }\n} );<\/code><\/pre><\/div><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">javascript<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-javascript\"><code class=\"language-javascript\">\/\/ JavaScript: Initialize editor after page load\njQuery(document).ready(function($) {\n    var settings = wp.editor.getDefaultSettings();\n    wp.editor.initialize(&#039;my_editor_id&#039;, settings);\n});<\/code><\/pre><\/div><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">wp_default_editor()<\/h2><p>Determine which editor should be displayed by default.<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function wp_default_editor(): string<\/code><\/pre><\/div><p><strong>Returns:<\/strong> <code>string<\/code> &#8211; Either <code>'tinymce'<\/code>, <code>'html'<\/code>, or <code>'test'<\/code>.<\/p><p><strong>Since:<\/strong> 2.5.0<\/p><p><strong>Description:<\/strong><\/p><p>Checks user preferences (stored in user settings cookie) to determine which editor tab to show. Falls back to TinyMCE if the user can use rich editing.<\/p><p><strong>Example:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">$default = wp_default_editor();\n\nif ( &#039;html&#039; === $default ) {\n    \/\/ User prefers the Code editor\n}<\/code><\/pre><\/div><p><strong>Hooks:<\/strong><\/p><ul class=\"wp-block-list\"><li><code>wp_default_editor<\/code> &#8211; Filter the default editor choice<\/li><\/ul><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">user_can_richedit()<\/h2><p>Check if the current user can access the visual editor.<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function user_can_richedit(): bool<\/code><\/pre><\/div><p><strong>Returns:<\/strong> <code>bool<\/code> &#8211; Whether the user can access the visual editor.<\/p><p><strong>Since:<\/strong> 2.1.0<\/p><p><strong>Description:<\/strong><\/p><p>Checks multiple conditions:<\/p><ol class=\"wp-block-list\"><li>User&#8217;s &quot;rich_editing&quot; preference (defaults to true for logged-out users)<\/li><li>Browser compatibility (Safari, Chrome, Firefox, Edge, Opera, IE 11+)<\/li><li>Mobile device support<\/li><\/ol><p><strong>Example:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">if ( user_can_richedit() ) {\n    \/\/ Show TinyMCE\n} else {\n    \/\/ Fall back to textarea\n}<\/code><\/pre><\/div><p><strong>Hooks:<\/strong><\/p><ul class=\"wp-block-list\"><li><code>user_can_richedit<\/code> &#8211; Filter whether the user can access the visual editor<\/li><\/ul><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">format_for_editor()<\/h2><p>Format text for display in the editor.<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function format_for_editor( string $text, string $default_editor = null ): string<\/code><\/pre><\/div><p><strong>Parameters:<\/strong><\/p><figure class=\"wp-block-table\"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>$text<\/code><\/td><td>string<\/td><td>The text to format<\/td><\/tr><tr><td><code>$default_editor<\/code><\/td><td>string<\/td><td>The default editor (<code>'html'<\/code> or <code>'tinymce'<\/code>)<\/td><\/tr><\/tbody><\/table><\/figure><p><strong>Returns:<\/strong> <code>string<\/code> &#8211; The formatted text.<\/p><p><strong>Since:<\/strong> 4.3.0<\/p><p><strong>File:<\/strong> <code>wp-includes\/formatting.php<\/code><\/p><p><strong>Description:<\/strong><\/p><p>Escapes the text using <code>htmlspecialchars()<\/code> with the blog&#8217;s charset. Used internally by <code>_WP_Editors::editor()<\/code> when TinyMCE is active.<\/p><p><strong>Example:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">$content = format_for_editor( $raw_content, &#039;tinymce&#039; );<\/code><\/pre><\/div><p><strong>Hooks:<\/strong><\/p><ul class=\"wp-block-list\"><li><code>format_for_editor<\/code> &#8211; Filter the formatted text<\/li><\/ul><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">get_editor_stylesheets()<\/h2><p>Get the stylesheets applied to the editor.<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function get_editor_stylesheets(): array<\/code><\/pre><\/div><p><strong>Returns:<\/strong> <code>array<\/code> &#8211; Array of stylesheet URLs.<\/p><p><strong>Since:<\/strong> 4.3.0<\/p><p><strong>File:<\/strong> <code>wp-includes\/theme.php<\/code><\/p><p><strong>Description:<\/strong><\/p><p>Returns URLs for editor stylesheets registered by the theme via <code>add_editor_style()<\/code>. Checks both parent and child themes.<\/p><p><strong>Example:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">$stylesheets = get_editor_stylesheets();\n\nforeach ( $stylesheets as $url ) {\n    echo &#039;&lt;link rel=&quot;stylesheet&quot; href=&quot;&#039; . esc_url( $url ) . &#039;&quot;&gt;&#039;;\n}<\/code><\/pre><\/div><p><strong>Hooks:<\/strong><\/p><ul class=\"wp-block-list\"><li><code>editor_stylesheets<\/code> &#8211; Filter the array of stylesheet URLs<\/li><\/ul><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">wp_enqueue_code_editor()<\/h2><p>Enqueue assets for the code editor (CodeMirror).<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function wp_enqueue_code_editor( array $args ): array|false<\/code><\/pre><\/div><p><strong>Parameters:<\/strong><\/p><figure class=\"wp-block-table\"><table><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>$args<\/code><\/td><td>array<\/td><td>Configuration arguments<\/td><\/tr><\/tbody><\/table><\/figure><p><strong>Args:<\/strong><\/p><figure class=\"wp-block-table\"><table><thead><tr><th>Key<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>type<\/code><\/td><td>string<\/td><td>MIME type of file being edited<\/td><\/tr><tr><td><code>file<\/code><\/td><td>string<\/td><td>Filename (extension used for type detection)<\/td><\/tr><tr><td><code>theme<\/code><\/td><td>WP_Theme<\/td><td>Theme being edited<\/td><\/tr><tr><td><code>plugin<\/code><\/td><td>string<\/td><td>Plugin being edited<\/td><\/tr><tr><td><code>codemirror<\/code><\/td><td>array<\/td><td>CodeMirror setting overrides<\/td><\/tr><tr><td><code>csslint<\/code><\/td><td>array<\/td><td>CSSLint rule overrides<\/td><\/tr><tr><td><code>jshint<\/code><\/td><td>array<\/td><td>JSHint rule overrides<\/td><\/tr><tr><td><code>htmlhint<\/code><\/td><td>array<\/td><td>HTMLHint rule overrides<\/td><\/tr><\/tbody><\/table><\/figure><p><strong>Returns:<\/strong> <code>array|false<\/code> &#8211; Settings for the code editor, or false if not enqueued.<\/p><p><strong>Since:<\/strong> 4.9.0<\/p><p><strong>File:<\/strong> <code>wp-includes\/general-template.php<\/code><\/p><p><strong>Description:<\/strong><\/p><p>Enqueues CodeMirror for syntax highlighting in code editors. Returns false if the user has disabled syntax highlighting.<\/p><p><strong>Example:<\/strong><\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">$settings = wp_enqueue_code_editor( array(\n    &#039;type&#039; =&gt; &#039;text\/css&#039;,\n) );\n\nif ( $settings ) {\n    wp_add_inline_script(\n        &#039;code-editor&#039;,\n        sprintf(\n            &#039;jQuery(function($){wp.codeEditor.initialize(&quot;my_css_textarea&quot;, %s);});&#039;,\n            wp_json_encode( $settings )\n        )\n    );\n}<\/code><\/pre><\/div><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">wp_get_code_editor_settings()<\/h2><p>Get code editor settings without enqueueing.<\/p><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function wp_get_code_editor_settings( array $args ): array|false<\/code><\/pre><\/div><p><strong>Parameters:<\/strong><\/p><p>Same as <code>wp_enqueue_code_editor()<\/code>.<\/p><p><strong>Returns:<\/strong> <code>array|false<\/code> &#8211; Code editor settings, or false if disabled.<\/p><p><strong>Since:<\/strong> 4.9.0<\/p><p><strong>Hooks:<\/strong><\/p><ul class=\"wp-block-list\"><li><code>wp_code_editor_settings<\/code> &#8211; Filter the code editor settings<\/li><\/ul><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">Related JavaScript API<\/h2><p>After enqueueing with <code>wp_enqueue_editor()<\/code>, these JavaScript functions are available:<\/p><h3 class=\"wp-block-heading\">wp.editor.initialize()<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">javascript<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-javascript\"><code class=\"language-javascript\">wp.editor.initialize( id, settings );<\/code><\/pre><\/div><p>Initialize a TinyMCE\/Quicktags editor instance.<\/p><h3 class=\"wp-block-heading\">wp.editor.remove()<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">javascript<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-javascript\"><code class=\"language-javascript\">wp.editor.remove( id );<\/code><\/pre><\/div><p>Remove an editor instance.<\/p><h3 class=\"wp-block-heading\">wp.editor.getContent()<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">javascript<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-javascript\"><code class=\"language-javascript\">var content = wp.editor.getContent( id );<\/code><\/pre><\/div><p>Get editor content.<\/p><h3 class=\"wp-block-heading\">wp.editor.getDefaultSettings()<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">javascript<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-javascript\"><code class=\"language-javascript\">var settings = wp.editor.getDefaultSettings();<\/code><\/pre><\/div><p>Get default editor settings object.<\/p><hr class=\"wp-block-separator\"\/><h2 class=\"wp-block-heading\">Usage Patterns<\/h2><h3 class=\"wp-block-heading\">Settings Page Editor<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function my_settings_page() {\n    $content = get_option( &#039;my_content&#039;, &#039;&#039; );\n    ?&gt;\n    &lt;form method=&quot;post&quot; action=&quot;options.php&quot;&gt;\n        &lt;?php settings_fields( &#039;my_settings&#039; ); ?&gt;\n        \n        &lt;?php wp_editor( $content, &#039;my_content_editor&#039;, array(\n            &#039;textarea_name&#039; =&gt; &#039;my_content&#039;,\n            &#039;textarea_rows&#039; =&gt; 15,\n        ) ); ?&gt;\n        \n        &lt;?php submit_button(); ?&gt;\n    &lt;\/form&gt;\n    &lt;?php\n}<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Frontend Editor<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function frontend_editor_shortcode() {\n    if ( ! is_user_logged_in() ) {\n        return &#039;Please log in to edit.&#039;;\n    }\n    \n    wp_enqueue_editor();\n    \n    ob_start();\n    wp_editor( &#039;&#039;, &#039;frontend_content&#039;, array(\n        &#039;textarea_name&#039; =&gt; &#039;user_content&#039;,\n        &#039;media_buttons&#039; =&gt; false,\n        &#039;teeny&#039;         =&gt; true,\n        &#039;textarea_rows&#039; =&gt; 8,\n    ) );\n    return ob_get_clean();\n}\nadd_shortcode( &#039;editor&#039;, &#039;frontend_editor_shortcode&#039; );<\/code><\/pre><\/div><h3 class=\"wp-block-heading\">Meta Box with Quicktags Only<\/h3><div class=\"code-block-wrapper\"><div class=\"code-block-header\"><span class=\"code-block-language\">php<\/span><button class=\"code-copy-btn\" aria-label=\"Copy code\"><svg><use href=\"https:\/\/chubes.net\/wp-content\/themes\/chubes\/assets\/icons\/chubes.svg#icon-copy\"><\/use><\/svg><\/button><\/div><pre data-chubes-enhanced class=\"wp-block-code language-php\"><code class=\"language-php\">function my_meta_box_callback( $post ) {\n    $content = get_post_meta( $post-&gt;ID, &#039;_my_meta&#039;, true );\n    \n    \/\/ Use Quicktags only to avoid TinyMCE DOM issues in meta boxes\n    wp_editor( $content, &#039;my_meta_editor&#039;, array(\n        &#039;textarea_name&#039; =&gt; &#039;my_meta&#039;,\n        &#039;tinymce&#039;       =&gt; false,\n        &#039;media_buttons&#039; =&gt; false,\n        &#039;textarea_rows&#039; =&gt; 5,\n        &#039;quicktags&#039;     =&gt; array(\n            &#039;buttons&#039; =&gt; &#039;strong,em,link,code&#039;,\n        ),\n    ) );\n}<\/code><\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Public functions for working with the WordPress Classic Editor (TinyMCE and Quicktags). File: wp-includes\/general-template.php (primary) Additional: wp-includes\/formatting.php, wp-includes\/theme.php wp_editor() Renders a TinyMCE\/Quicktags editor instance. function wp_editor( string $content, string $editor_id,&#8230;<\/p>\n","protected":false},"featured_media":0,"template":"","meta":{"footnotes":""},"tags":[],"project":[616],"project_type":[749],"class_list":["post-5605","documentation","type-documentation","status-publish","hentry","project-editor","project_type-wordpress-reference"],"project_info":{"id":589,"name":"WordPress Core","slug":"wordpress-core"},"project_type_info":{"id":749,"name":"WordPress Reference","slug":"wordpress-reference"},"_links":{"self":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/5605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation"}],"about":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/types\/documentation"}],"version-history":[{"count":3,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/5605\/revisions"}],"predecessor-version":[{"id":8919,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/5605\/revisions\/8919"}],"wp:attachment":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/media?parent=5605"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/tags?post=5605"},{"taxonomy":"project","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/project?post=5605"},{"taxonomy":"project_type","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/project_type?post=5605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}