I am creating translations for my plugin.
To fetch .mo files from my-plugin/languages directory , I use the function

//Load translation
function load_plugin_textdomain() {
    load_plugin_textdomain( 'my-plugin', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
add_action( 'plugins_loaded', 'load_plugin_textdomain' );

How can i set the location to wp-content/languages
Setting the location to ABSPATH.'/wp-content/languages' doesn't work.

1 Answer 1


If anybody else is looking for the anwser , Here it is

function load_txtdomain() {
    $locale = apply_filters( 'plugin_locale', get_locale(), 'my-plugin' );
    load_textdomain( 'my-plugin', WP_LANG_DIR . '/my-plugin-' . $locale . '.mo' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.