load_script_translations
Filter HookDescription
Filters script translations for the given file, script handle and text domain.Hook Information
File Location |
wp-includes/l10n.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1330 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$translations
|
JSON-encoded translation data. |
string
|
$file
|
Path to the translation file that was loaded. |
string
|
$handle
|
Name of the script to register a translation domain to. |
string
|
$domain
|
The text domain. |
Usage Examples
Basic Usage
<?php
// Hook into load_script_translations
add_filter('load_script_translations', 'my_custom_filter', 10, 4);
function my_custom_filter($translations, $file, $handle, $domain) {
// Your custom filtering logic here
return $translations;
}
Source Code Context
wp-includes/l10n.php:1330
- How this hook is used in WordPress core
<?php
1325 * @param string $translations JSON-encoded translation data.
1326 * @param string $file Path to the translation file that was loaded.
1327 * @param string $handle Name of the script to register a translation domain to.
1328 * @param string $domain The text domain.
1329 */
1330 return apply_filters( 'load_script_translations', $translations, $file, $handle, $domain );
1331 }
1332
1333 /**
1334 * Loads plugin and theme text domains just-in-time.
1335 *
PHP Documentation
<?php
/**
* Filters script translations for the given file, script handle and text domain.
*
* @since 5.0.2
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/l10n.php
Related Hooks
Related hooks will be displayed here in future updates.