How to use Yoast SEO backend in english even if WPLANG variable is not english?

I added this code to my functions.php file

add_filter('locale', 'wpse27056_setLocale');
function wpse27056_setLocale($locale) {
    if ( is_admin() ) {
        return 'en_US';
    }

    return $locale;
}

so the frontend is available in ro_RO and wp-admin is available in en_US

Well… that almost worked excepting Yoast’s WordPress SEO plugin which is translated in romanian.

What can i do with that plugin to be displayed in english?

2 Answers
2

That plugin loads its language the moment its main file is included:

load_plugin_textdomain( 'wordpress-seo', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );

So when your locale filter is used, the language is already there. :/

Move your small plugin into the mu-plugins directory. You can create it if it doesn’t exists in wp-content. That should load your plugin earlier than Yoast’s.

Lesson: Never load your language files before wp_loaded.

Leave a Comment