This thread is resolved. Here is a description of the problem and solution.
Problem: You are developing a site using WPML's auto-translate feature and have encountered an issue where links within content translated using the Advanced Custom Fields (ACF) remain in the original language and point to the main language pages. Solution: To resolve this issue, you need to modify your template code to ensure that links are correctly translated and point to the appropriate language versions. Here is a step-by-step guide:
Ensure that your ACF link field is set to 'Translate' to allow for the translation of the link URL and text.
Modify your template code to use the
wpml_permalink
filter for translating the URL, and the
wpml_translate_string
filter for translating the link title. Here is an example of how you can implement this:
Adjust the return value of the link field to 'Link URL' to ensure the correct data type is used for URLs.
Please note that this solution might be outdated or not applicable to your specific case. If this solution does not resolve your issue, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.
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.
Background of the issue:
I am developing a site and using WPML's auto translate feature. I created an empty page with two links to other pages that have translated versions. I used the advanced editor to translate automatically.
Symptoms:
The content is translated, but the links remain in the original language and continue to point to the main language.
For example, in the content, there is a link to the page "hidden link", and we have a French version of this page: "hidden link". However, the translation in the advanced editor kept the original version ("hidden link") instead of changing the link to "hidden link". You can see it on screenshot.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Hello,
WPML can handle internal links for default WordPress content and some default WordPress Blocks or some widgets of popular page builders.
Such internal links will usually not appear on the translation editor but we are currently having known issues with translating internal links inside buttons, calls to actions, and other similar blocks. Our developers are working on a solution for these issues.
The Color Box Link, seems to be a custom Block or Page Builder Widget. May I ask which plugin is responsible for this element?
For now:
If a link is not being handled as an internal link which is why it is appearing on the WPML Translation Editor.
You will for now need to adjust this link manually.
The Color Box Link is created using Advanced Custom Fields (ACF).
it's acf flexible content block (see screenshot).
it's set to "translate" (see screenshot).
1. In the ACF settings, I set the **link** field to "copy."
2. I create a new page.
3. I add ACF flexible blocks to the page, where the **"link copy"** field is included.
4. I save the page.
5. I add the French translation by opening the page in the **Advanced Editor**.
6. The link does not appear in the list, meaning it is interpreted as internal.
7. translate automatically
8. Go to translated page. However, the link still points to the main language instead of the French version, even though a French version of the page exists:
**hidden link
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
After making changes to the field settings you need to make a minor edit to the original page/post's link field and save the page/post again to generate a new translation job.
If you still do not see the link on the Advanced Translation Editor, please try using the search field on top and type "http".
Now i see link in translation advanced editor.
But it doesn't translate link to french verison, it still points to main language page.
Flexible content is set as "copy", link field is "translate"
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Correct, the translation engine (Google, Microsoft, Deep L) does not know anything about your website and will not know how to handle the URL.
This is why this field by default is set to "Copy", and will not appear on the WPML Translation Editor. In this case, it should automatically use the translated URL if you are handling an internal link and the page that you are linking to is translated and published.
I don’t quite understand. You said, **"it should automatically use the translated URL if you are handling an internal link and the page that you are linking to is translated and published."**
However, in my case, it does not automatically use the translated URL. Even if I set the link field to **"Copy"**, it still points to the main language instead of the translated version.
Even though the link points to an internal page that is translated and published, link still points to the main language. Why does this happen?