[Resolved] Is there a way to redirect to a translated version of a page?
This thread is resolved. Here is a description of the problem and solution.
Problem: The client has a multilingual site with English and Dutch languages. They noticed that while the content was translated by WPML, the URLs in the static HTML custom "menu" were not updated to point to the corresponding translated pages. The client wanted to know if there is a setting in WPML that automatically redirects users to the translated version of a page when they are on the Dutch homepage and click a link that has a Dutch translation available.
Solution: We informed the client that static HTML cannot be translated by WPML. Only PHP code that includes proper GetText calls can be translated within WordPress. Therefore, to achieve the desired functionality, the client would need to update the static HTML links manually to point to the correct translated pages. We also provided a guide on how to translate themes created by the client, which can be found here:
If this solution does not apply to your case, or if it seems outdated, we recommend opening 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. If further assistance is needed, please contact us in the 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.
There's probably a simple answer to this, but I couldn't find a solution online.
My example:
I had a site that was English only and I've used WPML to create a Dutch version of the site. WPML translated the text of the content but the URLs were not changed.
For example, on the English homepage, there is a link to the About Us page that links to the English About Us page. WPML translated the text of the page for the Dutch version of the homepage, but the link for "About Us" still links to that original English version of the page.
Now, we have also translated that About Us page to Dutch, so my question is....
If a person is viewing the Dutch homepage (at the /nl/ sub domain) and clicks a link to an English page WHICH HAS a Dutch translation available, is there a setting that will force the person to the Dutch page?
Or, do I just have to update all the content-area based links throughout my site manually?
About the content:
WPML will by default not display internal links on the Advanced Translation Editor unless you use page builders that work with shortcodes.
It looks as if you are using Gutenberg Blocks, correct?
Did you already try to edit and save the original content and then apply the translation again?
While doing this please revise if the link is not displayed on the Advanced Translation Editor, or if it is, then please translate it accordingly using the second language URL for the content.
If this will not solve the issue, please let me know.
This didn't address my question. Let me try again.
On my site, I have an English and a Dutch version of a page:
English: hidden link
Dutch: hidden link
My question is whether or not there a setting in WPML so that if:
1. A visitor is viewing a Dutch page (for example the Dutch version of the homepage -- hidden link) and
2. he clicks a link to an English version of a page (hidden link) THAT HAS a Dutch translation available (hidden link)
3. he will be sent to the Dutch version of the page because he was ON a Dutch translated page
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
As long a visitor is on a Dutch version of your site, the internal links should always redirect to Dutch content unless the visitor uses the language switcher to navigate to another language.
If the language switcher is used, WPML will redirect to the translation of the current content or redirect to the homepage in the selected second language if no translation exists.
We are not using a language switcher that WPML provides. We use a custom menu that simply directs users to the site URL that corresponds to the language. You can see that in the "Global Locations" drop-down menu at the top of: hidden link
Does custom navigation like this omit some functionality in WPML? Because it's not behaving like you describe.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
This depends on how the menu was created.
If you link towards pages dynamically, then WPML should be able to adjust those links by going to WPML > WP Menus Sync.
In case you use custom links in your menu, then you will need to edit those links in each menu accordingly or translate the links at WPML > String Translation.
I am not talking about the site menus which use WP Core menu functionality. Those are fine.
The custom "menu" I'm referring to above in Reply #15287223 is not a WP Core menu, it's just code with links to the following places: hidden link hidden link hidden link
If you click the link in that reply and click the "Global Locations" item at the top of the site, you'll these are direct links to the different sites.
So, this is not a WPML "language switcher" widget or anything like that, in case that widget does something other than simply direct a person to a different URL.
Would directing people directly to those URLs omit the functionality I see missing?
I'm asking about links in the content area of the page and all I'm asked about are the menus, which I specifically state are not the topic of my question.