load_translation_file
Filter HookDescription
Filters the file path for loading translations for the given text domain. Similar to the {@see 'load_textdomain_mofile'} filter with the difference that the file path could be for an MO or PHP file.Hook Information
File Location |
wp-includes/l10n.php
View on GitHub
|
Hook Type | Filter |
Line Number | 843 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$file
|
Path to the translation file to load. |
string
|
$domain
|
The text domain. |
string
|
$locale
|
The locale. |
Usage Examples
Basic Usage
<?php
// Hook into load_translation_file
add_filter('load_translation_file', 'my_custom_filter', 10, 3);
function my_custom_filter($file, $domain, $locale) {
// Your custom filtering logic here
return $file;
}
Source Code Context
wp-includes/l10n.php:843
- How this hook is used in WordPress core
<?php
838 *
839 * @param string $file Path to the translation file to load.
840 * @param string $domain The text domain.
841 * @param string $locale The locale.
842 */
843 $file = (string) apply_filters( 'load_translation_file', $file, $domain, $locale );
844
845 $success = $i18n_controller->load_file( $file, $domain, $locale );
846
847 if ( $success ) {
848 if ( isset( $l10n[ $domain ] ) && $l10n[ $domain ] instanceof MO ) {
PHP Documentation
<?php
/**
* Filters the file path for loading translations for the given text domain.
*
* Similar to the {@see 'load_textdomain_mofile'} filter with the difference that
* the file path could be for an MO or PHP file.
*
* @since 6.5.0
* @since 6.6.0 Added the `$locale` parameter.
*
* @param string $file Path to the translation file to load.
* @param string $domain The text domain.
* @param string $locale The locale.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/l10n.php
Related Hooks
Related hooks will be displayed here in future updates.