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.

Elementor users - please update WPML to the latest version to maintain compatibility. More details here - https://wpml.org/changelog/2024/12/wpml-4-6-15-critical-update-for-elementor-sites/
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: Africa/Cairo (GMT+02:00)

Tagged: 

This topic contains 16 replies, has 1 voice.

Last updated by Osama Mersal 1 day, 13 hours ago.

Assisted by: Osama Mersal.

Author Posts
December 20, 2024 at 2:05 pm #16534538

Kresimir

Background of the issue:
I am trying to translate ACF repeater fields registered via PHP using WPML. When translating posts using the WPML editor, the field doesn't translate correctly. Instead of showing the array, it only shows the number of rows. This issue is demonstrated in a post written in English (hidden link) and its translation (hidden link). However, when using the WordPress editor, the translation works as expected, as shown in these examples: English post (hidden link) and translated post (hidden link). The code used to register the field is in the 'Example field' plugin. You can download the plugin using the 'Download Plugins and Themes from Dashboard' plugin. Access to WP Admin is available with an account registered to wpml@wpml.org.

Symptoms:
When translating posts using WPML editor, the repeater field doesn't translate correctly and only shows the number of rows instead of the array.

Questions:
Why does the WPML editor not translate the ACF repeater field correctly?
How can I ensure the repeater field translates properly using WPML?

December 20, 2024 at 5:11 pm #16535085

Laura
Supporter

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+01:00)

Hi,

thanks for contacting us.

Which is the translation preference of the repeater and of the subfields?

December 21, 2024 at 9:53 am #16536224

Kresimir

Hey Laura.

The repeater has wpml_cf_preferences set to 1 (copy). From what I can tell from your docs that's the correct setting for the repeater (https://wpml.org/tutorials/2022/06/how-to-translate-acf-repeater-fields/). The repeater only has one sub field which is a text field and that had the wpml_cf_preferences set to 2 (translate). Here is a gist of the whole plugin used for the example (hidden link).

Let me know if you require something else from me.

Thank you for your help.

December 23, 2024 at 11:16 am #16540054

Osama Mersal
Supporter

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

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

Hi,

I'm Osama from WPML forums support. I'll be glad to help you today.

First of all, sorry for the late reply; it was due to a higher workload.

Please log in to this hidden link">sandbox site and create the same field group to replicate this issue.

If the issue is replicable, please let me know how to reproduce it to check it and consult our 2nd tier support team.

Best regards,
Osama

December 23, 2024 at 12:51 pm #16540349

Kresimir

Hey Osama. I think you misunderstand the issue. The field in question is registered using code registration that both ACF and WPMl support. So there is no point for me to add a field on the sandbox site and create a group since the group is created via code. Or you can do that also since I provided a gist with the code. What I can do is install the plugin that creates the field. Does that work for you? Also how can I demonstrate the field result on the sandbox site? What I mean is my test site has a var_dump() function that shows the field value on the active theme. That's just the demonstration of what is the field value. How can I add that on the sandbox site?

December 23, 2024 at 2:07 pm #16540660

Osama Mersal
Supporter

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

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

Hi,

Thanks for your reply. I uploaded the "Example field" plugin. After that, I used the following code to show the fields in the hidden link">single.php template.

// check if the repeater field has rows of data
if( have_rows('example_repeater') ):

    // loop through the rows of data
    while ( have_rows('example_repeater') ) : the_row();

        // display a sub field value
        the_sub_field('example_title');

    endwhile;

else :

    // no rows found

endif;

Please check this hidden link">post and try to replicate the issue there.

Thanks for your cooperation

Best regards,
Osama

December 23, 2024 at 2:29 pm #16540708

Kresimir

Hey Osama. Thank you for clearing this up and adding the code.

I've added the posts where you can see the issue. Here is the English post (hidden link) and here is the translation of that post (hidden link). As you can see on the English post the code you've added has data (hidden link) while the translation does't show anything (hidden link) but the values are present when I open the translation to edit it (hidden link).

Let me know if you need anything else from me.

December 23, 2024 at 2:58 pm #16540804

Osama Mersal
Supporter

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

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

Hi,

Thanks for your cooperation and reply. Would you please create a new test post and translate it to check the issue?

Best regards,

December 23, 2024 at 3:20 pm #16540853

Kresimir

Now the translation shows the data but I can also see meta key values from the field in the admin (hidden link).

December 23, 2024 at 3:21 pm #16540854

Kresimir

Sorry I forgot to post the entries I made:
- English: hidden link
- Translation: hidden link

December 23, 2024 at 3:22 pm #16540857

Osama Mersal
Supporter

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

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

Hi,

Thanks for your reply. I set them as translatable in WPML-> Settings-> Custom Fields Translation section.

Best regards,

December 23, 2024 at 3:36 pm #16540910

Kresimir

What about the setting used in the code registration (hidden link). That is already set to be translatable so why isn't WPML picking up on that and also what about the meta key values in the admin? There are not visible in any other fields except now.

December 23, 2024 at 3:58 pm #16540984

Osama Mersal
Supporter

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

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

Hi,

It seems like this issue.

Please try the mentioned workaround and let me know if it fixes the issue.

Thanks,
Osama

December 23, 2024 at 4:20 pm #16541079

Kresimir

Hey Osama. It fixes the issue the problem is we can't switch to using the JSON. All of our fields are registered in code and to change them would be a massive cost on production. So from what I can see is this is a know bug. Do you know when will it be fixed?

December 23, 2024 at 4:23 pm #16541100

Osama Mersal
Supporter

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

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

Hi,

I checked the ticket in our Dev team queue, and there are some tickets with more priority, so I'm afraid I don't have an ETA for the fix.

In the meantime, you can use the workaround on the page I previously shared or set the field meta key as translatable.

Best regards,
Osama