Set English WordPress Admin Dashboard on a multilingual site

The PHP code snippet below this article will set your WordPress Admin Dashboard in English even your site is using different default language. Of course, the code will go into your function.php file.

English WordPress Dashboard Plugin

For those who don’t like pasting code snippet is ready a very small lightweight English WordPress Dashboard plugin tested with WordPress 5.2.2 and you can download it here.

After activating the plugin your admin dashboard will appear in English (en_GB). The plugin is very small and has no other settings and options, because it has the only one purpose: dashboard in English even whole site has different default language.

Having this as plugin is fine, especially when your client will decide to use different language and not English, so the plugin can be just deactivated.

function en_adm_add_hooks()
{add_filter('locale', 'en_adm_locale');}
add_action('plugins_loaded', 'en_adm_add_hooks');
function en_adm_locale($locale)
{if (en_adm_use_en()) {return 'en_GB';}
return $locale;}
function en_adm_use_en()
{return en_adm_is_admin() && !en_adm_is_frontend_ajax();}
function en_adm_is_admin()
{return is_admin() || en_adm_is_tiny_mce() || en_adm_is_login_page();}
function en_adm_is_frontend_ajax()
{return defined('DOING_AJAX') && DOING_AJAX && false === strpos(wp_get_referer(),'/wp-admin/');}
function en_adm_is_tiny_mce()
{return false !== strpos($_SERVER['REQUEST_URI'], '/wp-includes/js/tinymce/');}
function en_adm_is_login_page()
{return false !== strpos($_SERVER['REQUEST_URI'], '/wp-login.php');}