Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing issues with redirecting users to the appropriate language version of their site based on geographic location using WPML. They have set up a custom language for the US and want users from the US and Germany to be redirected to specific URLs when visiting their site.
Solution:
We explained that WPML's redirection feature does not support geolocation-based redirection. It operates based on the browser's language settings. Therefore, users will be redirected according to the default language set in their browser, not their geographic location. For implementing redirection based on browser language, we recommend following the documentation provided here: Automatic Redirect Based on Browser Language.

If this solution does not align with your needs, or if it seems outdated or irrelevant to your specific case, please open a new support ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, you can visit our support forum at WPML Support Forum.

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 2 replies, has 1 voice.

Last updated by Andreas W. 1 week, 4 days ago.

Assisted by: Andreas W..

Author Posts
January 23, 2025 at 11:34 am #16627506

eventzillaA

Background of the issue:
I am working on a site under development and have created a new custom language for the US version using WPML. I added the US version to the default language by going to WPML → Languages → Language URL format, checking the option 'Use directory for default language,' and adding 'us' in the box.

Symptoms:
When a user visits hidden link, they are being redirected to a different page instead of hidden link.

Questions:
How can I set up redirection so that users are redirected to the appropriate URL based on their location?
How can I ensure that users from the United States are redirected to hidden link?
How can I ensure that users from Germany are redirected to hidden link?

January 23, 2025 at 11:34 am #16627512

eventzillaA

Actually, for the default language, I created a new custom language for the US version. Then, for another requirement, I added the US version to the default language. To do this, I went to WPML → Languages → Language URL format, checked the option "Use directory for default language," and added "us" in the box.

However, now when a user visits hidden link, they are being redirected to a different page, rather than hidden link.

Additionally, I have another query: When a user visits the site from different locations (since there are 8 languages total), I want them to be redirected to the appropriate URL based on their location.

For example:

If a user accesses the site from the United States (i.e., hidden link), they should be redirected to hidden link.
If a user accesses the site from Germany, they should be redirected from hidden link to hidden link.

Could you help me figure out how to set this up correctly?

January 24, 2025 at 5:20 pm #16632274

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

The redirection feature of WPML does not have a geolocation feature.

It works by browser language instead, which means the default language that the user currently has set in its browser's settings.

Documentation:
https://wpml.org/documentation/getting-started-guide/language-setup/automatic-redirect-based-on-browser-language/

Best regards
Andreas