Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Bobby 2 years, 11 months ago.

Assigned support staff: Bobby.

Author Posts
October 28, 2019 at 11:41 pm #4843335



How can I load a different versions of the site according to their location? As an example English as the default language for users from New Zeland where Malay as the default for users from Singapore?

October 29, 2019 at 12:34 am #4843377


Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

WPML currently offers the ability to do an automatic browser language redirect which essentially detects the visitor's browser language and then if that language exists in your site it redirects them to it.

ex. Browser is set to Italian, and you have a site with Italian/English, once I visit I will be redirected to Italian.
The downfall with this is that it's based on the visitor's browser language rather than their location.

At the moment Geolocation is possible with custom coding which does fall beyond the scope of our support but perhaps I can point you in the right direction.

1. Use a plugin or PHP script to look up the IP and match it to a country. I don't have any specific recommendations but this is what I found:

IP2Location Redirection


IP2Location (PHP Class)
hidden link
hidden link
hidden link

2. Use wp_redirect to redirect the user:

Altogether it would look something like this:

$get_country = New IPCountry();
$get_country_location = $get_country->resolve_IP('');
if( $get_country_location == 'usa' ) {
    wp_redirect( get_bloginfo('url') . "/en/" );
    //wp_redirect( get_bloginfo('url') . "?lang=en" );
}elseif( $get_country_location == 'canada' ) {
    wp_redirect( get_bloginfo('url') . "/fr/" ); 
    //wp_redirect( get_bloginfo('url') . "?lang=fr" );

I hope this helps.

3. You can also consider contacting one of our certified partners from this link:

Before doing so please review this page:

Kind Regards,