Wordpress - How do I change the value of lang=en-US
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:
Create a global variable
$locale
in yourwp-config.php
:$locale = 'en_GB';
Declare the constant
WPLANG
in yourwp-config.php
:define( 'WPLANG', 'en_GB' );
This has been deprecated, but it'll still work.
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.