apply_filters( 'load_textdomain_mofile', string $mofile , string $domain )
Filters MO file path for loading translations for a specific text domain.
Description Description
Parameters Parameters
- $mofile
-
(string) Path to the MO file.
- $domain
-
(string) Text domain. Unique identifier for retrieving translated strings.
Source Source
File: wp-includes/l10n.php
Changelog Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
An example that allows to override the default translations of a plugin:
add_filter( 'load_textdomain_mofile', 'my_custom_translation_file', 10, 2 ); /* * Replace 'textdomain' with your plugin's textdomain. e.g. 'hello-dolly'. * Define your filename, such as: yourtranslationfile-en_GB.mo * Define the location, for example: wp-content/languages/textdomain/yourtranslationfile-en_GB.mo */ function my_custom_translation_file( $mofile, $domain ) { if ( 'textdomain' === $domain ) { $mofile = WP_LANG_DIR . '/textdomain/yourtranslationfile-' . get_locale() . '.mo'; } return $mofile; }