I've set up a multisite Wordpress installation, because I want to work with multipul languages. Everything work except the lang attribute. I want the admin panel to be English, but I want to give lang attribute the value of the language of the site it self (for example german). The only way I see to that is to change the admin panel to that language.

The code I'm using:

   <html <?php language_attributes(); ?>>

The value I get on the site (with English admin panel):

   <html lang="en_GB">

The value I want to get with the English admin panel:

   <html lang="de">

My site uses a folder for the language not a sub domain. So the German site is: http://localhost/de/

  • Did you change the language for the user? The lang attribute in wp-admin is defined by the language of the logged in user.
    – fischi
    Commented Jan 29, 2016 at 9:49
  • @fischi No we only have one user. That user always wants the admin page to be English, but now I need to manage to get the lang attribute to go to DE/SE etc depending on the site the visitors are.
    – Jeff
    Commented Jan 29, 2016 at 9:53

1 Answer 1


This is fixed. I made a small script to get this working.

Because it was a multi language site I just named the site's to the language they should be in. So the English page is named English, German page is called German etc. Made a small php script to check what the page name is so a variable will fill this one in.

PHP code:

# Check language of page
$currentLang = get_bloginfo(); 

if ($currentLang == 'English') {
   $htmlLang = "en-GB";
elseif ($currentLang == 'German') {
   $htmlLang = "de";
# etc 

Your Answer

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

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