Why load_textdomain work but not load_plugin_textdomain?

In my plugin’s init function

    load_textdomain( 'myplugin', ABS_PATH_TO_MO_FILE ); // OK

    load_plugin_textdomain( 'myplugin', false,  ABS_PATH_TO_LANGS_DIR); // No effect

    echo( __('Test', 'myplugin') );

In the code above, the load_textdomain works, but not load_plugin_textdomain, any idea?

1 Answer
1

Looking at the source load_plugin_textdomain takes three arguments:

load_plugin_textdomain( $domain, $abs_rel_path = false, $plugin_rel_path = false )

It seems you are passing the absolute path to your language domain, as a relative path. Try:

load_plugin_textdomain( 'myplugin', ABS_PATH_TO_LANGS_DIR);

Leave a Comment