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 Yvette 1 year, 1 month ago.

Assigned support staff: Yvette.

Author Posts
June 5, 2019 at 11:41 am #3960035



We have set up a root page on hidden link that has links to english and french language versions of the site.
Currently, we use custom buttons instead of the language switcher, but we could use a language switcher on that page if it is needed.

We would like for the visitors to be automatically redirected to their selected language the next time they visit the site by site cookies. I have looked at some previous answers on the forums and most of the things I tried doing through PHP either didn't work or broke the site access completely.

I was looking at these documentation and threads:

What should be the simplest way to accomplish this, keeping in mind that additional languages might be added in the future, so we would need the possibility to expand?

June 6, 2019 at 8:06 am #3966913


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

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


Sorry for the delay to answer your question.

There are 2 parts to this forum question.
1. What normal WPML behaviour is
2. What options you have with custom coding

1. Normal WPML
The root page is unique in that it is not associated with any language. So, no "language" related information exists on this page and therefore no redirects will occur. So you would need to create your own cookie if you are interested in processing any kind of language-related cookie.

2. Options.
As you have read in the other tickets, given that you are trying to add functionality that is not currently part of the WPML solution, I would need to direct you to a WPML contractor for help. Our forum support policy does not include support for custom solutions.

However, I did find a stackoverflow answer that might be helpful:

Hopefully that kind of approach might be useful for you or at least send you in the right direction.