tiny_mce_before_init filter-hookWP 2.5.0

Filters the TinyMCE config before init.

Usage

add_filter( 'tiny_mce_before_init', 'wp_kama_tiny_mce_before_init_filter', 10, 2 );

/**
 * Function for `tiny_mce_before_init` filter-hook.
 * 
 * @param array  $mce_init  An array with TinyMCE config.
 * @param string $editor_id Unique editor identifier, e.g. 'content'. Accepts 'classic-block' when called from block editor's Classic block.
 *
 * @return array
 */
function wp_kama_tiny_mce_before_init_filter( $mce_init, $editor_id ){

	// filter...
	return $mce_init;
}
$mce_init(array)
An array with TinyMCE config.
$editor_id(string)
Unique editor identifier, e.g. 'content'. Accepts 'classic-block' when called from block editor's Classic block.

Changelog

Since 2.5.0 Introduced.
Since 3.3.0 The $editor_id parameter was added.

Where the hook is called

_WP_Editors::editor_settings()
tiny_mce_before_init
wp_tinymce_inline_scripts()
tiny_mce_before_init
wp-includes/class-wp-editor.php 815
$mce_init = apply_filters( 'tiny_mce_before_init', $mce_init, $editor_id );
wp-includes/script-loader.php 620
$tinymce_settings = apply_filters( 'tiny_mce_before_init', $tinymce_settings, 'classic-block' );

Where the hook is used in WordPress

wp-includes/default-filters.php 295
add_filter( 'tiny_mce_before_init', '_mce_set_direction' );