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.

This topic contains 12 replies, has 2 voices.

Last updated by aurelieC-9 1 year, 8 months ago.

Assisted by: Yvette.

Author Posts
July 20, 2022 at 11:26 am #11700503

aurelieC-9

Hi!
I'm trying to set up a specific mechanic for translating repeater fields on an ACF options page.

I have a repeater with multiples fields in it (checkboxes, text inputs...), some I want synced between languages, others translated. The repeater itself is set to "Copy", its fields are either set to "Copy" or "Translate" (see screenshot for visual context).

Now, I have multiple problems with this:
- the number of items in the repeater is synchronised, but not their order. If I move the first item to the bottom in the default language, then save and go to another language, nothing will have changed.
- this creates another problem: because the order is not synchronised, if I move something to the bottom in the default language, then edit a field in it (set to copy), it will copy the edit to the bottom item of other languages, which is not the right one since the order hasn't changed. There's not "link" between translated items, the copying feature seems to only be based off the order.
- if I set a field to "Copy" I want it to be the synced to all languages, which means if I edit that field in any language (default or not), I need that edit to be applied to the same item on all languages. Currently, the edit gets ignored except if I do it from the default language.

There seems to be mentions of a repeater field synchronization feature in ACFML (https://wpml.org/fr/compatibility/2020/06/acfml-1-7-0-adds-the-option-to-disable-repeater-field-synchronization/), but I have no idea how to enable it or even if it does what I'd like it to do.

Hope my problems are clear and that you'll be able to help! Thanks a lot 🙂
Best regards

Screenshot 2022-07-20 at 11.53.56.png
July 20, 2022 at 12:42 pm #11701537

aurelieC-9

Update: I have tried setting up a repeater field in a regular WordPress page, and the synchronisation does work, it even shows the checkbox to disable it if needed. However, I can't make it work in options page.

July 20, 2022 at 5:46 pm #11703771

Yvette
Supporter

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

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

Hello

I'll be helping you .

There seems to be a few questions/issues here. Let's try to number each one and close them off one-by-one.

1. Repeater Fields
1.1 Seems like the primary one is the "ordering" and subsequent update. Is this correct?

1.2 You wrote: "... if I edit that field in any language (default or not), I need that edit to be applied to the same item on all languages...."
Response: unfortunately, this only works from default to target languages. What you are asking for is not supported.

2. Repeater fields in Options page
If you set the translation preferences of the custom fields on your Options page to Copy, you will need to manually save this setting on your secondary language page(s). This is expected behavior.

- https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/#setting-the-translation-preferences-of-the-acf-options-page-custom-fields-to-copy

Did you manually save after editing the options?

July 21, 2022 at 9:41 am #11708705

aurelieC-9

Hi, thank you for your reply.

It’s quite unfortunate that edits in languages other than the default one get ignored. Do you intend to make a setting to change That behaviour in the future? It really doesn’t make much sense in the context of ACF options pages.

You’re correct when you say that most of my problems come from the lack of order syncing in options pages. Do you have any idea how could I fix it? Thank you

July 21, 2022 at 9:56 am #11709139

Yvette
Supporter

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

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

Hello

1. Sync direction between translations
You asked: "Do you intend to make a setting to change That behaviour in the future? "

To my knowledge there are no plans in this direction at all. You could always make a feature request that will get looked at and evaluated here:
https://wpml.org/suggest-a-new-feature-for-wpml/

2. Ordering of ACFM Options fields

So let's tackle this issue. To start, please recreate the issue on this new sandbox site. Upload the latest version of ACF and then create as simple an example that still reflects your issue as possible. e.g. 1 field group with 2 text fields.

hidden link

July 22, 2022 at 7:40 am #11717039

aurelieC-9

Hello

Alright, I tried recreating the issue on your sandbox but I couldn't, which means it's probably coming from my end. I'm gonna try disabling some things and debugging to see why it's not working on my site, I'll keep you updated.

Thank you!

July 22, 2022 at 7:50 am #11717109

Yvette
Supporter

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

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

Perfect - I appreciate that. We wait for your news when you are ready.

July 22, 2022 at 8:15 am #11717211

aurelieC-9

Found the problem!

In my theme, I initiate acf_add_options_page() in the init hook of WordPress. It seems to be causing some issues with the syncing feature since it simply doesn't appear. If I put it outside of the hook, it works.

I added both situations in the functions.php of the sandbox if you want to test it out yourself.

July 22, 2022 at 8:45 am #11717415

Yvette
Supporter

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

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

Tricky, interesting, and subtle!

Thank you for sharing your finding with the community. Does this now resolve your issue?

July 22, 2022 at 9:26 am #11717677

aurelieC-9

Well yes, but actually no 😬

I'm having another problem with the syncing. Now when it's enabled and I save the fields in the main language, I get tons of warnings and a white page. It seems to be one for every line of the repeaters.

I tried the usual debugging things but no luck, except when deleting all the data from repeaters and adding it again. It works but I can't do this for every one of them since there's way too many.

Any idea why it's doing it and what could I do about it? Thank you again

Screenshot 2022-07-22 at 11.17.53.png
July 22, 2022 at 9:56 am #11717889

aurelieC-9

I found this recent topic about my problem: https://wpml.org/forums/topic/warning-invalid-argument-supplied-for-foreach-in-acfml/

I did what Bruno said at the end and it seems to fix the issue 🙂

I'll keep this topic open just in case I run into other problems, and will close it soon if I don't. Thanks a lot for your help!

Best regards

July 22, 2022 at 10:10 am #11718071

Yvette
Supporter

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

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

OK!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.