pre_load_textdomain
Filter HookDescription
Filters whether to short-circuit loading .mo file. Returning a non-null value from the filter will effectively short-circuit the loading, returning the passed value instead.Hook Information
File Location |
wp-includes/l10n.php
View on GitHub
|
Hook Type | Filter |
Line Number | 749 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool|null
|
$loaded
|
The result of loading a .mo file. Default null. |
string
|
$domain
|
Text domain. Unique identifier for retrieving translated strings. |
string
|
$mofile
|
Path to the MO file. |
string|null
|
$locale
|
Locale. |
Usage Examples
Basic Usage
<?php
// Hook into pre_load_textdomain
add_filter('pre_load_textdomain', 'my_custom_filter', 10, 4);
function my_custom_filter($loaded, $domain, $mofile, $locale) {
// Your custom filtering logic here
return $loaded;
}
Source Code Context
wp-includes/l10n.php:749
- How this hook is used in WordPress core
<?php
744 * @param bool|null $loaded The result of loading a .mo file. Default null.
745 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
746 * @param string $mofile Path to the MO file.
747 * @param string|null $locale Locale.
748 */
749 $loaded = apply_filters( 'pre_load_textdomain', null, $domain, $mofile, $locale );
750 if ( null !== $loaded ) {
751 if ( true === $loaded ) {
752 unset( $l10n_unloaded[ $domain ] );
753 }
754
PHP Documentation
<?php
/**
* Filters whether to short-circuit loading .mo file.
*
* Returning a non-null value from the filter will effectively short-circuit
* the loading, returning the passed value instead.
*
* @since 6.3.0
*
* @param bool|null $loaded The result of loading a .mo file. Default null.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @param string $mofile Path to the MO file.
* @param string|null $locale Locale.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/l10n.php
Related Hooks
Related hooks will be displayed here in future updates.