WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

WPMU Functions/load muplugin textdomain

Description

Loads the plugin's translated strings.

This function is the same as load_plugin_textdomain however it is designed for the mu-plugins directory rather than its WordPress equivalent which is designed for the normal plugins directory.

Parameters

$domain
(string) (required) Unique identifier for retrieving translated strings.
Default: None
$mu_plugin_rel_path
(string) (optional) Relative path to the location of the .mo files.
Default: false

Return Values

boolean 
Returns true if the language file was loaded successfully. Returns false, if the language file could not be loaded (it is not readable or the mo file reader can not understand it).

Usage

<?php load_muplugin_textdomain($domain$mu_plugin_rel_path); ?>

Examples

This example assumes that the plugin's .mo files are placed in a 'lang' folder in your plugin's directory. If the locale is set to 'es_US', WordPress will attempt to load 'my-plugin-es_US.mo' from the 'lang' directory.

add_action( 'plugins_loaded', 'myplugin_muload_textdomain' );
function myplugin_muload_textdomain() {
	load_muplugin_textdomain( 'my-plugin', basename( dirname(__FILE__) ) . '/lang' );
}

Change Log

Source File

load_muplugin_textdomain() is located in wp-includes/l10n.php.