the_editorfilter-hookWP 2.1.0

Changes the HTML markup of the WordPress editor (the HTML to which TinyMCE and Quicktags are then attached).

This hook can be useful when a non-standard tag attribute or an element must be added to the HTML editor. This can be done using str_replace().

Usage

add_filter( 'the_editor', 'wp_kama_the_editor_filter' );

/**
 * Function for `the_editor` filter-hook.
 * 
 * @param string $output Editor's HTML markup.
 *
 * @return string
 */
function wp_kama_the_editor_filter( $output ){

	// filter...
	return $output;
}

Parameters

$output(string)

The visual editor HTML.

By default, the parameter contains the following HTML:

'<div id="wp-' . $editor_id_attr . '-editor-container" class="wp-editor-container">' .
		$quicktags_toolbar .
		'<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr( $set['textarea_name'] ) . '" ' .
		'id="' . $editor_id_attr . '">%s</textarea></div>'

Examples

#1 Replace part of the post editing form

add_filter('the_editor', 'the_editor_demo_funct');
function the_editor_demo_funct( $wrapper ) {

	if ( false !== strpos($wrapper, 'id="content"') ) {
		$wrapper = str_replace('</textarea>', '</textarea><p>Enter text in this field.</p>', $wrapper );
	}

	return $wrapper;
}

Changelog

Since 2.1.0 Introduced.

Where the hook is called

_WP_Editors::editor()
the_editor
wp-includes/class-wp-editor.php 267-273
$the_editor = apply_filters(
	'the_editor',
	'<div id="wp-' . $editor_id_attr . '-editor-container" class="wp-editor-container">' .
	$quicktags_toolbar .
	'<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr( $set['textarea_name'] ) . '" ' .
	'id="' . $editor_id_attr . '">%s</textarea></div>'
);

Where the hook is used in WordPress

Usage not found.