load_muplugin_textdomain

Load the translated strings for a plugin residing in the mu-plugins directory.

Description

load_muplugin_textdomain( (string) $domain, (string) $mu_plugin_rel_path = '' ); 

Parameters (2)

0. $domain (string)
Text domain. Unique identifier for retrieving translated strings.
1. $mu_plugin_rel_path — Optional. (string) => ''
Relative to WPMU_PLUGIN_DIR directory in which the .mo file resides. Default empty string.

Usage

  1. if ( !function_exists( 'load_muplugin_textdomain' ) ) { 
  2. require_once ABSPATH . WPINC . '/l10n.php'; 
  3.  
  4. // Text domain. Unique identifier for retrieving translated strings. 
  5. $domain = ''; 
  6.  
  7. // Optional. Relative to `WPMU_PLUGIN_DIR` directory in which the .mo 
  8. // file resides. Default empty string. 
  9. $mu_plugin_rel_path = ''; 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = load_muplugin_textdomain($domain, $mu_plugin_rel_path); 
  13.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/l10n.php  
  1. function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { 
  2. /** This filter is documented in wp-includes/l10n.php */ 
  3. $locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain ); 
  4.  
  5. $mofile = $domain . '-' . $locale . '.mo'; 
  6.  
  7. // Try to load from the languages directory first. 
  8. if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) { 
  9. return true; 
  10.  
  11. $path = trailingslashit( WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ) ); 
  12.  
  13. return load_textdomain( $domain, $path . '/' . $mofile );