Filter hook 'load_script_translation_file'

in WP Core File wp-includes/l10n.php at line 1312

View Source

load_script_translation_file

Filter Hook
Description
Filters the file path for loading script translations for the given script handle and text domain.

Hook Information

File Location wp-includes/l10n.php View on GitHub
Hook Type Filter
Line Number 1312

Hook Parameters

Type Name Description
string|false $file Path to the translation file to load. False if there isn't one.
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_translation_file
add_filter('load_script_translation_file', 'my_custom_filter', 10, 3);

function my_custom_filter($file, $handle, $domain) {
    // Your custom filtering logic here
    return $file;
}

Source Code Context

wp-includes/l10n.php:1312 - How this hook is used in WordPress core
<?php
1307  	 *
1308  	 * @param string|false $file   Path to the translation file to load. False if there isn't one.
1309  	 * @param string       $handle Name of the script to register a translation domain to.
1310  	 * @param string       $domain The text domain.
1311  	 */
1312  	$file = apply_filters( 'load_script_translation_file', $file, $handle, $domain );
1313  
1314  	if ( ! $file || ! is_readable( $file ) ) {
1315  		return false;
1316  	}
1317  

PHP Documentation

<?php
/**
	 * Filters the file path for loading script translations for the given script handle and text domain.
	 *
	 * @since 5.0.2
	 *
	 * @param string|false $file   Path to the translation file to load. False if there isn't one.
	 * @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: 3
  • File: wp-includes/l10n.php
Related Hooks

Related hooks will be displayed here in future updates.