wp_enqueue_editor()WP 4.8.0

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

0

#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.

Code of wp_enqueue_editor() WP 5.9.3

function wp_enqueue_editor() {
	if ( ! class_exists( '_WP_Editors', false ) ) {
		require ABSPATH . WPINC . '/class-wp-editor.php';
	}

	_WP_Editors::enqueue_default_editor();
}