Skip Navigation

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

Problem:
You are developing a site using WPML for automatic translation and facing an issue where ACF link fields on the English pages still contain links copied from the Dutch pages. Attempts to use 'Translate Link Goals' did not resolve the issue.
Solution:
We suggest you use WPML hooks to modify the URL to the current language to fix the issue.

$b_link = get_sub_field('link');
$translated_url_fix = apply_filters('wpml_permalink', $b_link['url']);
if ($b_label && $b_link) : ?>
<a class="butn butn-<?= $b_variant ?>" href="<?= $translated_url_fix ?>" target="<?= $b_link['target'] ?>">
</a>

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. If the problem continues, please do not hesitate to open a new support ticket at WPML support forum for further assistance.

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.

Tagged: 

This topic contains 11 replies, has 3 voices.

Last updated by igorL-6 10 months ago.

Assisted by: Osama Mersal.

Author Posts
September 3, 2024 at 9:57 am

kevinM-80

Background of the issue:
I am developing a site using WPML for automatic translation. The site is translated automatically, but I am facing an issue with ACF link fields.

Symptoms:
The ACF link fields on the English pages still contain the links copied from the Dutch pages. I tried using 'Translate Link Goals,' but this did not work.

Questions:
How can I ensure that ACF link fields automatically adjust to the English pages?

September 3, 2024 at 10:43 am
September 3, 2024 at 10:44 am #16135007

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please update this ticket when you run the test.

Thanks for your cooperation

Best regards,
Osama

September 5, 2024 at 6:24 am #16143187

kevinM-80

Hi,

I created the test page and changed the ACF link field to a URL, but the link field still contains the Dutch link instead of the English one.

Could you please take another look?

September 5, 2024 at 7:51 am #16143436

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please log in to this hidden link">sandbox site and create a test field group with a URL field.

After that, please use this field on a page and translate it to replicate the issue.

If the issue is replicable, please let me know to consult our 2nd tier support team.

Best regards,
Osama

September 5, 2024 at 12:47 pm #16145098

kevinM-80

I tried to recreate the issue, but we work with our own template, and I cannot recreate the issue without it. I provided you with the login details for the website where we are experiencing the issue. Could you check the website to possibly find the solution?

September 5, 2024 at 1:23 pm #16145281

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I added a simple code to print the URL. Please check the following pages and confirm that it's the same issue on your site:

1) hidden link

2) hidden link

Thanks for your cooperation

Best regards,
Osama

September 6, 2024 at 6:42 am #16147342

kevinM-80

Hi,

I've made some changes to the code, but it seems the issue persists. The link title is being translated automatically, but the structure of the URL remains unchanged.

September 6, 2024 at 10:04 am #16148116

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I'll consult our 2nd tier support team regarding this issue and update you as soon as they reply.

Best regards,
Osama

September 8, 2024 at 9:20 am #16152310

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I changed the code. Please check if the URL is translated correctly. (hidden link)

Best regards,
Osama

September 11, 2024 at 8:51 am #16165196

kevinM-80

Hi,

It looks like it's working properly now! I'll apply it in our case, and hopefully, that will fully solve it.

In any case, thanks a lot for all your help so far! I'll keep you posted.

September 11, 2024 at 8:52 am #16165200

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for your reply. Please let me know if the new approach fixed the issue on your site.

Thanks,
Osama

September 11, 2024 at 10:26 am #16165864
igorL-6

Hey, guys,
can you explain the solution to this problem?

We have a similar problem on the development version of the site: we need the URL link in the ACF field from the English page to link to the German page. Even though we don't have automatic translation turned on, it still translates the German url back to English. We are working with a custom template.

And it does this even if we put an absolute internal url in the custom acf block, when the page is loaded the url is replaced.

New threads created by Osama Mersal and linked to this one are listed below:

https://wpml.org/forums/topic/translate-acf-link-fields/