WordPress filter hook · part of WordPress core

load_textdomain_mofile

A WordPress core filter that 8 plugins also fire themselves, running on 14K+ sites between them.

“To force loading from a different place, use the `load_textdomain_mofile` filter.”

How to use load_textdomain_mofile

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'load_textdomain_mofile', function( $mofile, $domain ) {
	// Change $mofile here.
	return $mofile;
}, 10, 2 );

Argument names come from WPGlobus's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

8 plugins that fire load_textdomain_mofile

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WPGlobus icon WPGlobus8,000+ installs apply_filters( 'load_textdomain_mofile', $mofile, $domain ) includes/class-wpglobus-config.php:595
  2. Language Fallback icon Language Fallback5,000+ installs apply_filters( 'load_textdomain_mofile', $mofile, $domain ) language-fallback.php:106
  3. MO Cache icon MO Cache1,000+ installs apply_filters( 'load_textdomain_mofile', $mofile, $domain ) mo-cache.php:29
  4. Fast Translate icon Fast Translate10+ installs apply_filters( 'load_textdomain_mofile', $mofile, $domain ) fast-translate.php:35
  5. Native Gettext for WordPress icon Native Gettext for WordPress10+ installs apply_filters( 'load_textdomain_mofile', $mofile, $domain ) classes/class-native-load-textdomain.php:32
  6. Debug Bar Localization icon Debug Bar Localization10+ installs apply_filters( 'load_textdomain_mofile', $mo_file, $this->domain ) class-debug-bar-localization-log-domain-entry.php:64
  7. Dynamic MO Loader icon Dynamic MO Loader10+ installs apply_filters( 'load_textdomain_mofile', $mofile, $domain ) dynamic-mo-loader.php:29
  8. Tillbon icon TillbonFewer than 10 installs apply_filters( 'load_textdomain_mofile', $eigen . '.mo', 'tillbon' ) includes/class-counterpos-rest.php:808

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.