The load_muplugin_textdomain() WordPress PHP function loads the translated strings for a plugin residing in the mu-plugins directory.
Usage
load_muplugin_textdomain($domain, $mu_plugin_rel_path);
Input:
$domain
: ‘my-plugin’$mu_plugin_rel_path
: ‘my-plugin/lang’
Parameters
$domain
(string): Text domain. Unique identifier for retrieving translated strings.$mu_plugin_rel_path
(string, optional): Relative to WPMU_PLUGIN_DIR directory in which the .mo file resides. Default: ”
More information
See WordPress Developer Resources: load_muplugin_textdomain
Examples
Loading textdomain for a custom plugin
function my_custom_plugin_load_textdomain() { load_muplugin_textdomain('my-custom-plugin', 'my-custom-plugin/lang'); } add_action('plugins_loaded', 'my_custom_plugin_load_textdomain');
Loading textdomain for a multilingual plugin
function multilingual_plugin_load_textdomain() { load_muplugin_textdomain('multilingual-plugin', 'multilingual-plugin/languages'); } add_action('plugins_loaded', 'multilingual_plugin_load_textdomain');
Loading textdomain with a subdirectory
function nested_plugin_load_textdomain() { load_muplugin_textdomain('nested-plugin', 'nested-plugin/subdir/languages'); } add_action('plugins_loaded', 'nested_plugin_load_textdomain');
Loading textdomain without specifying a path
function default_path_plugin_load_textdomain() { load_muplugin_textdomain('default-path-plugin'); } add_action('plugins_loaded', 'default_path_plugin_load_textdomain');
Loading textdomain with a custom action
function custom_action_plugin_load_textdomain() { load_muplugin_textdomain('custom-action-plugin', 'custom-action-plugin/languages'); } add_action('custom_plugin_loaded', 'custom_action_plugin_load_textdomain');