• Hi
    on a woocommerce site,
    how do I Change the front end Language only, leaving the admin area in english?
    polylang doesnt work. it messes up the homepage.

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’ve never had to do this for any of my sites or client sites, but just by googling a little bit I found this:

    https://wordpress.stackexchange.com/questions/133882/how-to-change-the-language-for-the-front-end-only

    Check the first answer. This code that you paste on the functions.php file should, in theory, do the trick.
    Before doing it though, you need to go to the backend, go to options, switch the language to the one you want on the frontend only and click Save. This should download it and make it available for use by the snippet of code. Then switch it back to, say, English.

    Remember to switch ‘ar’ in this line: return ‘ar’; with the ISO languange code for the frontend languange you downloaded. Full list of ISO codes here: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes. If you don’t find it let me know.

    Hope this helps.

    Thread Starter holdportals

    (@holdportals)

    Hey, thanks
    will try it.

    Thread Starter holdportals

    (@holdportals)

    so I tried the first code and it didnt work.
    then I tried the bottom one and it did work, BUT the styling of the admin is messed up.

    any suggestions?

    function wp_noshor_redefine_locale($locale) {
        if( is_admin() ):
            switch_to_locale('en_US');
        endif;
    }
    add_filter('init','wp_noshor_redefine_locale');
    Thread Starter holdportals

    (@holdportals)

    this is embarrassing. I have been digging a bit about this and it appears that there is an option since wordpress 4.7 that enable to change the admin language on the users settings page.
    all plugins and code changes are unnecessary for me.

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change front end Language only’ is closed to new replies.