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.

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by Mateus Getulio 1 year, 10 months ago.

Assisted by: Mateus Getulio.

Author Posts
March 22, 2023 at 11:38 am #13304193

ghledisC

I updated the ACFML plugin from 1.10.4 to the newest this morning.
I had number fields (and other fields as well) set up across languages. They were set to copy the value or copy the value once.

Example:
I have a "speed" field for my custom post type machines.

The way it worked was that the post was published in English.

"Speed" was copied to the translated posts when creating the translations.

Now the speed field (that I had created for each language, because this was needed for facetwp to work correctly on the translated site) is repeated in the English post edit screen for each language i. e. there are 7 speed fields in the English and also in the translated languages (except these are 'locked').

Also, fields specifically only assigned to translated languages are now showing up in my source language (English)

How can I get back my previous setup while keeping up with the updates? Or where can I understand how the update changed the functionality? (the change log is not sufficient).

20230322123345_screenshot.jpg
20230322123411_screenshot.jpg
March 22, 2023 at 3:17 pm #13306681

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thanks for your contact, and welcome to the WPML support forum!

In our latest Advanced Custom Fields Multilingual version, when the 'Field Groups (acf-field-group)' post type is set as Translatable (and translated), fields are duplicated in the native editor.

This issue occurs because the function acf_get_field_groups() is called too early, causing the cache to be filled with unfiltered or partially filtered data. The cached field groups are not filtered by language at that stage.

Our developers are working on fixing this right now. A hotfix release will be issued shortly.
In the meantime you can follow this as a workaround:

Make a full backup of your site before proceeding
Add this code into your theme’s functions.php file:

    add_action( 'wp_loaded', function() {
        wp_cache_delete( acf_cache_key( 'acf_get_field_group_posts' ), 'acf' );
    } );

It should be solved. Please give it a try and let us know how it goes.

Thank you,
Mateus.

March 23, 2023 at 11:10 am #13314345

ghledisC

Thank you. Good to know that this is being worked on.

I added the code to functions.php. It did resolve the problem. Kind of. It now works as it is supposed to, but it takes a whole minute to load the edit-post page.

I will wait until the hotfix to do the update, and do some testing then.

In the meantime, I would like to understand how this new feature works. Meaning translation of ACF field values in ATE.

My current custom template is getting all advanced custom field values from the source language post (english post) and outputs through __('string_value', 'text_domain') in the correct language, including repeaters, groups, selects etc., because the values don't change between languages.

But there are some fields that have to (or had to) have duplicates in translated languages, because we also have facetwp installed, and in order to filter through translated posts, the posts had to have the fields to be filtered, and they couldn't have been taken just from the english.

Do you know how this update will affect this particular situation, or can you point me to a detailed description, so I can understand?

March 23, 2023 at 1:23 pm #13315517

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thanks for your reply.

Regarding this:

But there are some fields that have to (or had to) have duplicates in translated languages, because we also have facetwp installed, and in order to filter through translated posts, the posts had to have the fields to be filtered, and they couldn't have been taken just from the english.

Could you please clarify it, perhaps bringing an example where the fields are being filtered? So that I can check it better if it might be affected.

Moreover, I recommend that you double-check our new and updated ACF documentation:

- https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/
- https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/expert-translation-option/
- https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/recommended-custom-fields-translation-preferences-for-acf-and-wpml/

Please keep us posted. Thank you.

Regards,
Mateus.

March 24, 2023 at 7:13 am #13320439

ghledisC

The example is the archive page where I have put Facet WP filters for several fields.
hidden link
I am checking the documentation

March 24, 2023 at 10:20 am #13322071

ghledisC

What I would like to know how the template changes to output the translation of custom fields. Is it simply the_field('field_name') or does it have to be wrapped in __() with a specific text-domain?

March 24, 2023 at 5:09 pm #13325557

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thanks for your reply.

First, about the page: hidden link and the first question you asked previously:

Do you know how this update will affect this particular situation, or can you point me to a detailed description, so I can understand?

I'm not sure, but as far as I can see, it shouldn't be affected at all. Have you experienced any related issue?

Moreover, we have just released the ACFML version containing the permanent fix for our original issue here in the ticket: https://wpml.org/errata/advanced-custom-fields-multilingual-fields-are-duplicated-in-the-native-editor-when-acf-field-group-is-set-as-translatable/.

Please try to update it and check if everything is working well. Just make sure to have a website backup before doing it.

Right now we have two other known issues with ACF, you can check them and their solutions here: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/#known-issues

At last, regarding this:

What I would like to know how the template changes to output the translation of custom fields. Is it simply the_field('field_name') or does it have to be wrapped in __() with a specific text-domain?

It would be the second option - you have to use a gettext function to make the field possible to be localized and translated.

Please let me know if this explanation is clear to you and solves the question.

Thank you,
Mateus.