WordPress setup one language for admin and the other for theme

Filed Under: WordPress by Miloš Spasić Written on April 29th, 2014

Here is one quick tip, if you want to have one language for WordPress admin and the other language for theme, just add this to your theme functions.php file:

// setup one language for admin and the other for theme
// must be called before load_theme_textdomain()
 
function set_my_locale($locale) {
     $locale = ( is_admin() ) ? "en_US" : "sr_RS";
     setlocale(LC_ALL, $locale );
     return $locale;
}
add_filter( 'locale', 'set_my_locale' );

First language is for admin area, and second one is for theme and entire WordPress front end.

This must be called before: load_theme_textdomain()

If you have problems with plugins translation, check out function: load_plugin_textdomain()

Top of Page

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Top of Page