I am using polylang to change the language in frontend. it is working fine. I have two languages in the website. English and arabic.
What I am trying to do is, when(if) user changes the language in front end. The language in the admin panel has to be change too. But I think polylang only changes the language in frontend.
I tried adding this filter to check which language user currently using but it is not working
add_filter('locale', 'wpse27056_setLocale');
function wpse27056_setLocale($locale) {
if ( is_admin() ) {
/*
$currentLanguage = get_bloginfo('language');
return $currentLanguage;
*/
if(is_rtl()){
return "ar";
}
return "en-US";
}
}
My question is is there any way where I can code to change whole website's language?