• Hello all,

    There may be a simple answer to this, but does changing the “Website” language in the WordPress dashboard is supposed to affect the the “href lang” attribute of the site as well?

    In my case I would require the WP dashboard to be in English while the frontend (the actual website) is in German. Sounds easy enough, but when checking the source code after switching to English, I get this:

    Before:
    <!DOCTYPE HTML>
    <html lang=”de-DE”

    After:
    <!DOCTYPE HTML>
    <html lang=”en-US”

    Therefore, it looks like when changing the language in WordPress (the option being called “Website” rather than “Dashboard” language) is affecting the html lang tags as well.

    Not wanting to mess up with any of the SEO, I wonder if switching languages within WordPress also affects the frontend in any way. Surly it must be possible to have the dashboard in one language and the actual website in another language.

    Thanks all for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi. Easy fix is to add these lines in wp-config.php according to ref page in japanese (https://firegoby.jp/archives/2404):

    if (preg_match('/^\/wp\-admin/', $_SERVER['REQUEST_URI'])) {
        define('WPLANG', 'en-US');
    } else {
        define('WPLANG', 'de-DE');
    }

    However, this fix left adminbar in de-DE, he saids.

    To fix adminbar to be en-US while frontend html in de-DE, activate switch-lacale.php plugin hosted in gist and set define('SITE_LANG', 'de-DE'); in wp-config.php as frontend html lang.

    It is an old post, so I dont know if it works now.
    Hope this helps.

    Thank you ikaring, it’s working with me

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Changing WP language settings also changes “html lang” attribute’ is closed to new replies.