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?
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.
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']); ?>
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.