Filter hook 'mce_external_languages'

in WP Core File wp-includes/class-wp-editor.php at line 489

View Source

mce_external_languages

Filter Hook
Description
Filters the translations loaded for external TinyMCE 3.x plugins. The filter takes an associative array ('plugin_name' => 'path') where 'path' is the include path to the file. The language file should follow the same format as wp_mce_translation(), and should define a variable ($strings) that holds all translated strings.

Hook Information

File Location wp-includes/class-wp-editor.php View on GitHub
Hook Type Filter
Line Number 489

Hook Parameters

Type Name Description
array $translations Translations for external TinyMCE plugins.
string $editor_id Unique editor identifier, e.g. 'content'.

Usage Examples

Basic Usage
<?php
// Hook into mce_external_languages
add_filter('mce_external_languages', 'my_custom_filter', 10, 2);

function my_custom_filter($translations, $editor_id) {
    // Your custom filtering logic here
    return $translations;
}

Source Code Context

wp-includes/class-wp-editor.php:489 - How this hook is used in WordPress core
<?php
 484  						 * @since 5.3.0 The `$editor_id` parameter was added.
 485  						 *
 486  						 * @param array  $translations Translations for external TinyMCE plugins.
 487  						 * @param string $editor_id    Unique editor identifier, e.g. 'content'.
 488  						 */
 489  						$mce_external_languages = apply_filters( 'mce_external_languages', array(), $editor_id );
 490  
 491  						$loaded_langs = array();
 492  						$strings      = '';
 493  
 494  						if ( ! empty( $mce_external_languages ) ) {

PHP Documentation

<?php
/**
						 * Filters the translations loaded for external TinyMCE 3.x plugins.
						 *
						 * The filter takes an associative array ('plugin_name' => 'path')
						 * where 'path' is the include path to the file.
						 *
						 * The language file should follow the same format as wp_mce_translation(),
						 * and should define a variable ($strings) that holds all translated strings.
						 *
						 * @since 2.5.0
						 * @since 5.3.0 The `$editor_id` parameter was added.
						 *
						 * @param array  $translations Translations for external TinyMCE plugins.
						 * @param string $editor_id    Unique editor identifier, e.g. 'content'.
						 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-editor.php
Related Hooks

Related hooks will be displayed here in future updates.