wp_enqueue_editor()
Outputs the editor scripts, stylesheets, and default settings.
The editor can be initialized when needed after page load. See wp.editor.initialize() in wp-admin/js/editor.js for initialization options.
No Hooks.
Return
null
. Nothing.
Usage
wp_enqueue_editor();
Examples
#1 Example of connecting and initializing the editor
<?php // connect styles, scripts wp_enqueue_editor(); // run the script add_action( 'wp_footer', function(){ ?> <script> var id = textarea.attr( 'id' ); wp.editor.initialize( id, { tinymce: { wpautop: true }, quicktags: true }); </script> <?php }, 99);
Changelog
Since 4.8.0 | Introduced. |
wp_enqueue_editor() wp enqueue editor code WP 6.1.1
function wp_enqueue_editor() { if ( ! class_exists( '_WP_Editors', false ) ) { require ABSPATH . WPINC . '/class-wp-editor.php'; } _WP_Editors::enqueue_default_editor(); }