I have noticed that in the <html> tag on my WP site that the language is defined as US English.

<html lang="en-US" prefix="og: http://ogp.me/ns#">

I would like to change it to British English en-GB but I'm not sure of the best way.

I dug around and found language_attributes() in general-template.php which makes a call to get_bloginfo('language'). I could manually insert the value here but that doesn't seem like the best way to do it.

What is the proper way to change this value?


The value for that string is normally taken from the option WPLANG in your database table $prefix_options. You can set it in the backend under Settings/General (wp-admin/options-general.php) or per SQL.

There several ways to change that value per PHP:

  1. Create a global variable $locale in your wp-config.php:

    $locale = 'en_GB';
  2. Declare the constant WPLANG in your wp-config.php:

    define( 'WPLANG', 'en_GB' );

    This has been deprecated, but it'll still work.

  3. Filter locale:

    add_filter( 'locale', function() {
        return 'en_GB';

    This a very flexible way, because you can add more conditions to that function, for example check the current site ID in a multisite.

| improve this answer | |

As for recent version of WordPress 4+ the solution provided here is deprecated, please check my answer here for more details


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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