tiny_mce_before_init хук-фильтрWP 2.5.0

Filters the TinyMCE config before init.

Использование

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  $mceInit   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( $mceInit, $editor_id ){

	// filter...
	return $mceInit;
}
$mceInit(массив)
An array with TinyMCE config.
$editor_id(строка)
Unique editor identifier, e.g. 'content'. Accepts 'classic-block' when called from block editor's Classic block.

Список изменений

С версии 2.5.0 Введена.
С версии 3.3.0 The $editor_id parameter was added.

Где вызывается хук

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

Где используется хук в WordPress

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