Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- - 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Supporter timezone: America/Lima (GMT-05:00)

Tagged: 

This topic contains 7 replies, has 0 voices.

Last updated by Andreas W. 3 days, 15 hours ago.

Assisted by: Andreas W..

Author Posts
February 18, 2025 at 8:03 pm #16720822

Alex

Background of the issue:
I have translated an ACF field group that contains a select field with 3 values. I translated these 3 values, on the backend I see the change.

Symptoms:
On the frontend, it still shows the original string.

Questions:
Do I need to change the syntax of the "select" values in order for the translations to work properly?

February 18, 2025 at 11:39 pm #16721311

Andreas W.
Supporter

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

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

Hello,

Please make sure that the ACF Field Groups are set to "Not translateable" inside WPML > Settings > Post Type Translation. In case you translated the groups please delete any duplicated/translated groups.

---

It sounds as if you translated the choices successfully with the WPML Translation Editor or directly with WPML String Translation.

How are you rendering the select's choices on the Frontend?

Are you using a PHP Template? If so, could you please paste me the code that outputs the select field on Frontend?

---

Also, please verify if the current memory usage might be close to or above 128MB. You can find this detail at WPML > Support PHP.

Best regards
Andreas

February 19, 2025 at 12:44 am #16721414

Alex

Here's how I fixed it after the fields have been translated:

- I changed the return format of my select to "Both (Array)"
- In my PHP template I returned the label instead with this code: <?php echo esc_html($level['label']); ?>

Hopefully that'll help someone else! 🙂

wpml-acf.png
wpml-acf1.jpg
February 19, 2025 at 1:13 am #16721455

Andreas W.
Supporter

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

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

I am glad to hear you found a solution, even though this workaround is unexpected.

Did it not work when using "Label" as the return value of the field?

February 19, 2025 at 2:14 pm #16725113

Alex

For some reason when selecting "Label" as the return value I had a syntax error, so "Both" did the trick! 🙂

February 19, 2025 at 3:40 pm #16725665

Andreas W.
Supporter

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

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

The syntax error was referring to any plugin or did it refer to how the fields are rendered on the frontend in your theme?

Can you send me the detailed error, please?

February 20, 2025 at 3:15 pm #16730469

Alex

Hey Andreas, if I switch the return format to "Label" here's the error and the PHP code to output the field is the same as my previous image.

<?php echo esc_html($level['label']); ?>

wpml-acf.png
February 20, 2025 at 5:14 pm #16730851

Andreas W.
Supporter

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

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

This is an error coming from your theme's template file.

The "illegal string offset" warning usually occurs when you're trying to access an array element using a string key, but the variable you're working with isn't actually an array.

This is why you do not get an error when returning "Both" is an object (Array) and "Label" is a string.

Please follow ACF's documentation on how to display the fields correctly in your theme.

hidden link