This may sound like a simple and trivial question, but I’m using the following tag in a WordPress theme header file:
<html <?php language_attributes(); ?>>
Which is outputting:
<html dir="ltr" lang="en-US">
I wish to change the lang
attribute to “en-GB” as my blog and the language posts are written in are British English (en-GB) but I can’t find where this parameter is set in the WordPress admin settings, and there isn’t a value for it in the wp_options
database table either, which leaves me to believe setting the lang
value must be some sort of dark art?
Define the language attribute using:
You can get more information on it at
http://codex.wordpress.org/Installing_WordPress_in_Your_Language
As for recent version of WordPress 4+ this option
is deprecated, to update the language you need to follow either one of the following methods:
Method 1
Inside the wp-config.php put the following line:
Method 2 (recommended)
In database, XY_options table to and set an option of WPLAN to en_GB (where XY is the table prefix for your wordpress installation)
exemple queries:
insert
update
I am using WordPress 5.1.1 , at
wp-config.php
, choose right top line, put(For example, in case of Vietnamese language)
A bit late in the discussion here. I had the same need today and found that there is a plugin available for that: CHL-Change HTML Lang. The language of the backend/admin interface can be in one language while the posts/articles/portfolios can be set in another language. After activating the plugin hit SettingsâGeneral and change the HTML language tag, i.e., en-US, etc.
Another way is with add_filter: