WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
where should i add this code? exactly in what file from wp-content ? – m3tsys Apr 29 '13 at 11:26
@m3tsys wp-content/mu-plugins/fix-wpseo.php – toscho Apr 29 '13 at 11:33
Why is init not sufficient? It runs after load_textdomain, after all. – Johannes Pille Apr 9 '14 at 15:09
@JohannesPille And this is why it is too late. – toscho Apr 9 '14 at 15:10
Now I'm confused. wp_loaded runs even later - and that's what you recommended not to load one's language files before. – Johannes Pille Apr 9 '14 at 15:14

There is even a better solution: a filter called plugin_locale. It filters the locale argument before using it in load_plugin_textdomain.

add_filter( 'plugin_locale', 'mytheme_plugin_locale' );

function mytheme_plugin_locale() {
    return 'en_US';
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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