pll_preferred_language Not working
-
Hi,
Thanks for the great plugin.
I am trying to detect visiting user’s country and show my site in their language.
For example, if user is from France, i want to show my site in french. I used following code.
add_filter('pll_preferred_language', 'my_language_fallback1'); function my_language_fallback1($slug) { $IP=get_client_ip1(); //Get ip of visitor from a function (Works fine) $result=geoip_record_by_name($IP); // Get user details using this function (Works fine) $country=$result['country_name']; //Get user country (works fine). if($country=='France') { return $slug === false ? 'fr' : $slug; } else { return $slug === false ? 'en' : $slug; } }
I tried with french proxy from internet and found no change in the site. Please help me to fix this issue.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘pll_preferred_language Not working’ is closed to new replies.