load_script_translations
Filters script translations for the given file, script handle and text domain.
Usage
add_filter( 'load_script_translations', 'wp_kama_load_script_translations_filter', 10, 4 ); /** * Function for `load_script_translations` filter-hook. * * @param string $translations JSON-encoded translation data. * @param string $file Path to the translation file that was loaded. * @param string $handle Name of the script to register a translation domain to. * @param string $domain The text domain. * * @return string */ function wp_kama_load_script_translations_filter( $translations, $file, $handle, $domain ){ // filter... return $translations; }
- $translations(string)
- JSON-encoded translation data.
- $file(string)
- Path to the translation file that was loaded.
- $handle(string)
- Name of the script to register a translation domain to.
- $domain(string)
- The text domain.
Changelog
Since 5.0.2 | Introduced. |
Where the hook is called
wp-includes/l10n.php 1266
return apply_filters( 'load_script_translations', $translations, $file, $handle, $domain );