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

Filters the list of TinyMCE external plugins.

The filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.

The url should be absolute, and should include the js filename to be loaded. For example: 'myplugin' => 'http://mysite.com/wp-content/plugins/myfolder/mce_plugin.js'.

If the external plugin adds a button, it should be added with one of the mce_buttons

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

add_filter( 'mce_external_plugins', 'wp_kama_mce_external_plugins_filter', 10, 2 );

/**
 * Function for `mce_external_plugins` filter-hook.
 * 
 * @param array  $external_plugins An array of external TinyMCE plugins.
 * @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_mce_external_plugins_filter( $external_plugins, $editor_id ){

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

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

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

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

_WP_Editors::editor_settings()
mce_external_plugins
wp_tinymce_inline_scripts()
mce_external_plugins
wp-includes/class-wp-editor.php 417
$mce_external_plugins = apply_filters( 'mce_external_plugins', array(), $editor_id );
wp-includes/script-loader.php 596
$external_plugins = apply_filters( 'mce_external_plugins', array(), 'classic-block' );

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

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