Filter hook 'load_script_textdomain_relative_path'

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

View Source

load_script_textdomain_relative_path

Filter Hook
Description
Filters the relative path of scripts used for finding translation files.

Hook Information

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

Hook Parameters

Type Name Description
string|false $relative The relative path of the script. False if it could not be determined.
string $src The full source URL of the script.

Usage Examples

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

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

Source Code Context

wp-includes/l10n.php:1242 - How this hook is used in WordPress core
<?php
1237  	 * @since 5.0.2
1238  	 *
1239  	 * @param string|false $relative The relative path of the script. False if it could not be determined.
1240  	 * @param string       $src      The full source URL of the script.
1241  	 */
1242  	$relative = apply_filters( 'load_script_textdomain_relative_path', $relative, $src );
1243  
1244  	// If the source is not from WP.
1245  	if ( false === $relative ) {
1246  		return load_script_translations( false, $handle, $domain );
1247  	}

PHP Documentation

<?php
/**
	 * Filters the relative path of scripts used for finding translation files.
	 *
	 * @since 5.0.2
	 *
	 * @param string|false $relative The relative path of the script. False if it could not be determined.
	 * @param string       $src      The full source URL of the script.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/l10n.php
Related Hooks

Related hooks will be displayed here in future updates.