I have installed a wordpress theme, i can see the .mo and .po /public_html/wp-content/themes/themename/lang, the language I want to use is available.

Could you please advise on how to use a specific language? I don't want to change the admin language just the theme language.


Well, you actually do not need anything special to have two different languages in the back end and in the front end. I just tested it again on WP 5.1

  1. go to the settings and set the Site Language to the front end laguage, for example - German, then save.

  2. go to Users and then click edit on your administrator account. There you can set Language to English and save. That's it. Your front end will use German as base and the back end will be in English.


I think that your simplest option would be to update your installation using the localized version of WordPress for your native language (and making sure that WPLANG remains set accordingly), and then to use a plugin such as:

... in order to switch just the admin interface to English.


If anyone is still looking for that, here is what you should do since version 4.7

function wp_noshor_redefine_locale($locale) {
    if( is_admin() ):

This forces the dashboard to load in English, then you can go to settings, set the language you desire.


You can filter the string for locale, it holds the current language. And you can exclude the admin from that filter:

is_admin() or add_filter( 'locale', function() {
    return 'ar';
  • Actually, I mean how can i activate a specific language for the theme?
    – Hicham
    Feb 8 '14 at 11:56
  • This happens automatically when locale matches an existing translation file.
    – fuxia
    Feb 8 '14 at 11:57
  • sorry for bothering as i'm new to WP, but how can i make locale match the translation file?
    – Hicham
    Feb 8 '14 at 11:57
  • By adding the code above to a plugin or your theme’s functions.php.
    – fuxia
    Feb 8 '14 at 11:58
  • i have to enter then ar-AR for my theme to be in arabic?
    – Hicham
    Feb 8 '14 at 12:01

Here is the complete and a better solution to only change theme (front-end) or plugin language. It even works for changing even a specific page/post etc. language as well.

TLDR; There is a filter called locale, which determines which language to load. You can change to your specific language based on the conditions that you prefer.

Changing only Theme language, or based on other conditions, without touching the admin dashboard language.

add_filter('locale', function($locale) {

    if( is_admin() ) {
        return $locale; // Leave default language if it is admin side.

    // You can load language based on any conditional tags here, like, is_page(), is_singular(), is_archive() etc.
    // I want to change the language for all front end in this particular example.

    $locale = 'en_US'; // Change to your required language. The language must be installed and loaded.

    return $locale; // Return language to be used.


Before you change the language, you may need to load that language first.

In your theme or child theme, load the custom language by using this snippet.

add_action( 'after_setup_theme', function() {

    // Assuming your language files are in /wp-content/themes/your-theme/languages
    // Don't forget to change 'text-domain' to your theme text-domain.

    // For Theme.
    load_theme_textdomain( 'text-domain', get_template_directory() . '/languages' );

    // For Child Theme
    load_child_theme_textdomain( 'text-domain', get_stylesheet_directory() . '/languages' );

    // Remove the load_child_theme_textdomain if you are using it for the main theme,
    // OR Remove load_theme_textdomain if you are loading child theme language.


Similarly, you can change language based on URL, or for your plugin page, etc.

Hope it'll help. OR let me know if I missed something.


You can also try this:

1.Download jquery translate script from this link

2.How it works ( doc, live test )

function ravs_frontend_translate_script() {
    wp_enqueue_script( 'translate', get_template_directory_uri() . '/js/jquery.translate.js', array( 'jquery' ), '0.0.1', true );
add_action( 'wp_enqueue_scripts', 'ravs_frontend_translate_script' );

function ravs_translate_webpage_fx(){
    // run script after both script load for translate webpage
          //from english to german:
          jQuery('body').translate( 'ar' );
add_action('wp_footer','ravs_translate_webpage_fx', 999 ); // make sure this hook run after jquery-translate include in webpage
  • 2
    But that's using Google to translate the page isn't it, not using the .po files he already has?
    – Rup
    Feb 12 '14 at 18:26
  • @Rup Yes it is using google traslator not .po file. May be this is possible that .po file not contain translation for a random word then _e() simple echo it while google translator convert whole webpage. Feb 12 '14 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.