Skip to content Skip to sidebar

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

Problem:
The client wants to override the language redirection based on the country's IP address using a custom plugin, but it is not consistently working.
Solution:
We explained that WPML does not support redirection based on the country's IP address nor does it provide a hook for such functionality. We only support redirection based on browser language, which can be found here: Automatic redirect based on browser language.
For custom requirements like redirecting users from specific countries to specific languages, we recommended seeking assistance from developers who specialize in custom coding. You can find qualified contractors on our page: WPML Contractors. Additionally, reviewing similar cases might be beneficial, such as this one: Country-based redirect discussion.

If this solution does not apply to your case, or if it seems outdated, we 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. Should you need further assistance, please do not hesitate to open a new support ticket or 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 3 replies, has 3 voices.

Last updated by Marsel Nikolli 1 year, 10 months ago.

Assisted by: Marsel Nikolli.

Author Posts
June 20, 2024 at 5:28 am #15760809

adrianC-12

Background of the issue:
I want to override the redirection of languages based on the country's IP address. I tried some solutions using a custom plugin but it will not always work.

Symptoms:
The custom plugin solution for overriding language redirection based on country IP address is not consistently working.

Questions:
Can you please let me know if there is any hook that can help me override language redirection functionality?

June 20, 2024 at 7:03 am #15761645

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support. While you are waiting for one of my colleagues to take this ticket and work on it, let me provide you with the first debugging steps and try to help with the issue quickly.

As I understand you are using a custom plugin for this since WPML doesn't support such redirect, nor do we have such redirect implemented in our plugin or similar hook. Only what we have is redirect based on browser language:

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

Hope this helps.

Regards,
Drazen

June 20, 2024 at 12:32 pm #15763614

adrianC-12

Hi Drazen,

Thank you for the response.
We have already enabled those options.
However, I want to redirect users to the language based on my custom requirements.
I want to redirect specific country users to the specific language.
for example, I want to redirect the user from Malta country to be-en.

Your suggested option will not work for that type of requirement.

June 20, 2024 at 2:36 pm #15764665

Marsel Nikolli

Hi,

As my colleague mentioned, WPML doesn't have such an option as redirecting visitors based on their location, to be able to achieve what you might require custom coding which is beyond the scope of this support forum, we recommend that you check our contractors' page: https://wpml.org/contractors/.

Thank you for understanding and I hope you find this information helpful.

It might be helpful to check the information provided from this other ticket:
https://wpml.org/forums/topic/country-based-redirect/#post-4843377

Let me know if you have any more questions.

Kind regards,
Marsel