Skip Navigation

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

Problem:
You are using ACF blocks to build pages and want to translate link labels and URLs using WPML's Advanced Translation Editor (ATE). However, translations are overridden by the editor upon any update, and changing the ACF field name for translation purposes is not possible since it's an ACF block.
Solution:
First, try deleting one of the problematic links and adding it from scratch on the original page. This might allow the translation to work correctly. If you encounter issues with the new UI of the Advanced Translation Editor not approving all segments or saving translations, switch to the old user interface via the settings in the top right corner of the ATE.
Additionally, check for PHP warnings in your theme's header and components files, as these might be affecting the translation process. Fix these issues in your theme, then attempt the translation again.

If this solution does not resolve your issue or seems outdated, we 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 problems persist, please 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 4 replies, has 0 voices.

Last updated by marinaB-21 1 month, 1 week ago.

Assisted by: Andreas W..

Author Posts
February 15, 2025 at 6:22 pm #16709466

marinaB-21

Background of the issue:
I'm using ACF blocks to build pages on my site hidden link. On the page hidden link, I have two links at the end of the section 'Zum Anbieter' and 'Zum Review'. I want to translate these labels and links using WPML's Advanced Translation Editor (ATE). I tried translating in the page content, but the editor overrides it on any update. I followed the documentation at https://wpml.org/forums/topic/attempting-to-translate-an-acf-link-field/ and set the ACF field to expert and the ACF field name in settings to 'translate', but the issue persists. I also changed the content and link, but the problem remains. I saw that the ACF field name should not be the same, but there's no way to change it since it's an ACF block, and I'm using these blocks everywhere.

Symptoms:
The ACF link field translations are overridden by the editor on any update, and changes to content and links do not resolve the issue.

Questions:
How can I translate ACF link fields using WPML's Advanced Translation Editor without them being overridden?
Is there a way to change the ACF field name for translation purposes when using ACF blocks?

February 15, 2025 at 6:43 pm #16709536

Andreas W.
Supporter

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

Timezone: America/Lima (GMT-05:00)

Hello,

The link field by default is set to "Copy". This is the default setting when using the field group setting "Same fields across languages".

You will need to change the field group to "Expert" and set the Link field to "Translate".

When using ACF Blocks we currently have reported issues and for this we currently have the following workaround available:

Edit \acfml\classes\class-wpml-acf-blocks.php line 191 and replace

	private function get_text_type( $text ) {
		$type = 'LINE';
		if ( is_array( $text ) ) {
			$type = 'array';
		} elseif ( strip_tags( $text ) !== $text ) {
			$type = 'VISUAL';
		} elseif ( strpos( $text, "\n" ) !== false ) {
			$type = 'AREA';
		}
		return $type;
	}

with

	private function get_text_type( $text ) {
		$type = 'LINE';
		if ( is_array( $text ) ) {
			$type = 'array';
		} elseif ( strip_tags( $text ) !== $text ) {
			$type = 'VISUAL';
		} elseif ( strpos( $text, "\n" ) !== false ) {
			$type = 'AREA';
		} else if (preg_match('/^(?:https?):\/\/\S+/i', $text)) {
			$type = 'LINK';
		}
		return $type;
	}

IMPORTANT:
1) Add the absolute link instead of relative links
2) Set the links field to translate.

Adjust the code in "Advanced Custom Fields Multilingual" make an update to the original page and translate it again.

If this will not solve the issue, please let us know.

Best regards
Andreas

February 15, 2025 at 11:33 pm #16709866

marinaB-21

Hello Andreas,

Thank you for quick response.

I tried to change the plugin and replace code but I still have the same issue. What I also noticed after some time acf field is moved to "Copy" instead of "Translate" I move it again to translate but somehow after some time it moves back.

Steps:

1. Plugin code replaced
2. Acf field is set to expert
3. Fields are set to translate
4. Changed field in DE page
5. Opened tranlsation for EN and tried to find "Zum Review" or link from that field

Result: not found for both and found fields are back to "Copy"

Btw: you still have access to page so you can check.
Thanks in advance!

chrome_E0YtY2K1Yr.png
chrome_5HgwezwRo2.png
February 16, 2025 at 2:13 am #16710014

Andreas W.
Supporter

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

Timezone: America/Lima (GMT-05:00)

My apologies for the misunderstanding.

You said in your first comment that you are going to use the WPML's Advanced Translation Editor (ATE) to create the translation.

Setting the Link field to "Translate" should make the link text and link URL available inside the WPML Translation Editor, where you will need to translate both.

It might be that you need to use the search field inside ATE to search for the link URL by typing "http".

1) Open the original page, and edit the link text.
2) Save the page.
3) Open the WPML Translation Editor.

Are you now able to translate the link text and link URL?

---

You should not edit a translation manually on the WordPress Editor, if you use the WPML Translation Editor for translation. The ATE will overwrite any edit taken on the WordPress Editor in second languages.

February 18, 2025 at 11:09 am #16718344

marinaB-21

Hello, thank you for response,

I didnt want to translate manually on the WP editor, I just mentioned it to try to help you to undestrand the issue. So, I want to translate it using WPML editor like other content.

I followed your tutorial as you wrote but I still have the same issue. Also tried with "http"... still nothing.

Also suspicious is that it moves back from translate to copy again, no? You can check my screenshot for the settings. Also I can provide login data so you easily can check.

Thank you!

February 18, 2025 at 7:14 pm #16720651

Andreas W.
Supporter

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

Timezone: America/Lima (GMT-05:00)

I would like to request temporary access (wp-admin and FTP) to the site to investigate the issue further.

The required fields are below the comment section when you log in to leave the next reply. The information you provide is private, meaning only you and I can see and access it.

IMPORTANT
Please be sure to back up the site and database before granting us access.

If you cannot see the "wp-admin / FTP" fields, your post and site credentials will be set to "PUBLIC". DO NOT publish the data unless you see the required wp-admin / FTP fields.

The private reply form looks like this:
hidden link

The next time you reply, click on "I still need assistance".

Video:
hidden link

Please note that we are obliged to request this information individually on each ticket. We are not permitted to access any access information that was not specifically submitted on this ticket in the private response form.

February 19, 2025 at 9:21 pm #16726852

Andreas W.
Supporter

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

Timezone: America/Lima (GMT-05:00)

Thank you!

Until now I can confirm that the translation does not work as expected, even after having adjusted the custom field group and field settings, and applying the workaround.

Somehow the link objects still are not becoming available inside the translation editor.

It does not look to me to be the case, but can you please confirm that the same field names for those links are not used anywhere else in another group on the site?

February 19, 2025 at 10:01 pm #16726908

marinaB-21

Thank you for checking!

Its not used anywhere else, its specific for this block.

February 19, 2025 at 10:19 pm #16726944

Andreas W.
Supporter

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

Timezone: America/Lima (GMT-05:00)

I see, I will need some more time to investigate and will try to take a copy of your site for running further tests on a local, virtual server.

February 20, 2025 at 1:14 pm #16729664

Andreas W.
Supporter

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

Timezone: America/Lima (GMT-05:00)

On the original page, I deleted one of the links and added it from scratch.

The translation worked after that, on my local copy, but there was one issue I spotted.

The new UI of the Advanced Translation Editor seems not to be able to approve all the segments.

I am not sure why those issues occur. For example, I was not able to apply the translations for the button link texts and I was not able to save the translations for the links.

I had to use the settings of the Advanced Translation Editor on the top right and enable the option to use the old user interface.

---

There is a Warning occurring on the header of your theme:

Warning: Invalid argument supplied for foreach() in D:\Work\Local Sites\schweizerfinanzblog\app\public\wp-content\themes\schweizerfinanzblog\header.php on line 33

On the components that you are trying to translate the following Warnign occurs directly in front of the buttons:

Warning: Invalid argument supplied for foreach() in D:\Work\Local Sites\schweizerfinanzblog\app\public\wp-content\themes\schweizerfinanzblog\components\unsere-empfehlungen-company-component\unsere-empfehlungen-company-component.php on line 34

I suggest you fix those issues on the theme and then test again or switch to the old UI of the WPML Translation Editor and complete the translations, which should solve the issue.

translated.jpg
warning.jpg
March 2, 2025 at 12:02 pm #16765393

marinaB-21

Hello,

This solved my issue, its visible in old editor. Thank you very much for quick help and solution!