I would like to set WordPress theme to be in a language other than English, but I would like to keep the control panel of WordPress in English. How do I accomplish that?
Changing define('WPLANG', '');
in wp-config.php would not help, as it will change the language for the control panel as well.
I am not interested in a plugin, all I need is set the language for the theme, but not the control panel.
Thanks.
Here’s an example, front end will be Dutch, back end default English:
UPDATE
WordPress 4.0 deprecated the
WPLANG
constant (link). The site language is set from the admin panel: Settings -> General -> Site Language.Developers can now modify the locale by defining the
$locale
global inwp-config.php
, …… or with the
locale
filter:See also Greeso’s answer with regard to admin AJAX.
The answer by ‘diggy’ is great, and works most of the time. However it will not work in one situation:
If you are using AJAX within WordPress, then
$_SERVER['REQUEST_URI']
will containwp-admin/admin-ajax.php
even if you are at the site root (for example if you go to http://www.your-site.com, then$_SERVER['REQUEST_URI']
will returnwp-admin/admin-ajax.php
if you are using AJAX in that root page).Therefore, to work around this issue, you should modify the condition inspection to be as follows:
Update
For 4.0 and up, use the following