Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client has a custom ACF block called Header Block with multiple fields (title, subtitle, content, button label, etc.), but only the button label is showing, and the other fields are not. The client is following the WPML documentation for translating sites built with ACF but is facing an issue because the field names are not unique across blocks.

Solution:
We recommend ensuring that all field names are unique. This is a known limitation with ACF and WPML, as WPML handles custom fields by name, which are stored in the meta tables. Therefore, translation preferences are set by field name, necessitating their uniqueness. Here are some resources to help understand the importance of unique field names:

If this solution is not applicable due to it being outdated or not relevant to your case, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.

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 10 replies, has 3 voices.

Last updated by Osama Mersal 9 months, 1 week ago.

Assisted by: Osama Mersal.

Author Posts
February 23, 2024 at 1:58 pm #15338139

simpleT

Tell us what you are trying to do?

I have a custom ACF block called Header Block that has multiple fields (title, subtitle, Content, Button label etc...)

For some reason only the button label is showing, but none of the other fields, why is that?

Is there any documentation that you are following?

trying to follow this https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/

Is there a similar example that we can see?

What is the link to your site?

I have a local site but if you want I can also have it live somewhere to give you access.

acfproblem.png
February 23, 2024 at 5:50 pm #15338911

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

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

Thank you for contacting WPML support. While you are waiting for one of my colleagues to take this ticket and work on it, let me provide you with first debugging steps or if I can perhaps help with the issue quickly.

Please check in WPML > Settings > Custom Fields Translation if the desired fields are set as translatable.

If that does not help, one of my colleagues will soon come to continue support.

February 23, 2024 at 7:10 pm #15339091

simpleT

Thanks for answering Lucas.

None of the fields I have appear in the "Custom fields Translation" that you mentioned.

I want to point out like in my original post that these are ACF blocks if that makes a difference.

From ACF I only have acfml_non_translatable_locations

But again, like in my screenshot i have fields like btn1_label from the hero-unit block that don't appear here.

February 25, 2024 at 11:08 am #15341300

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.

1) First of all, sorry for the late reply; it was due to a higher workload. Please login to this sandbox site and import your ACF field groups and blocks. (hidden link)

After that, please create a test page using the problematic block and translate it to replicate the issue.

If the issue is replicable, please let me know how to reproduce it.

2) It's unrelated to the issue, but according to your Debug.info, the WP memory limit needs to be increased. PHP memory is fine, but WordPress uses 40Mb as default. The minimum requirements for WPML are 128 MB. (Kindly check this page https://wpml.org/home/minimum-requirements/)

You can increase it by adding the following code in your wp-config.php file right before the /* That's all, stop editing! Happy publishing. */ line:

/* Memory Limit */
define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M');

Best regards,
Osama

February 25, 2024 at 8:45 pm #15341968

simpleT

Hi.

I have confirmed that on your test site adding my block fields and adding it via functions.php works with the header-block.php file works.

I activated the glossary + advanced translation and can confirm that also works.

It looks like the problem was the fact that my field names need to be unique across blocks.

This is honestly very bad news as I have multiple blocks that have the field name "content" or "heading". Now it looks like I need to remake my whole site since if I change the field name the data that was added into it will dissapear...

How can I go around this issue?

Even something that can happen after the field was made in functions.php or something like that?

February 25, 2024 at 8:55 pm #15341969

simpleT

Just want to add, I have the same problem as the users here are explaining.

https://wpml.org/forums/topic/acfml-issues-with-fields-with-the-same-name/

February 26, 2024 at 7:19 am #15342367

Osama Mersal
Supporter

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

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

Hi,

Thanks for your update. I'm afraid that the name should be unique. Please check the following pages.

1- hidden link

2- hidden link

Best regards,
Osama

February 26, 2024 at 8:47 am #15342743

simpleT

This is unfortunate because it works to create them in ACF but for some reasom ACFML plugin can't diferentiate between blocks that use the same field???

Why would anyone create a field "body" and have 2 different blocks work with "body" but because of WPML and ACFML it should be "body_2" for the second one.

This is a huge miss from WPML and ACF.

February 26, 2024 at 8:59 am #15342802

Osama Mersal
Supporter

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

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

Hi,

I understand your frustration. Please check this guide to see a warning message about this case. (https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/#using-same-fields-across-languages)

This happens because WPML handles custom fields by name, so the translation preferences are set by field name. That's why it should be unique.

Sorry for the inconvenience

Best regards,
Osama

February 26, 2024 at 11:08 am #15343683

simpleT

Just want to make clear its not okay to set a warning as a Note on huge documentation page and expect people to not run into this issue.

As a final question is there anything that can be edited in the ACFML plugin (doesn't matter if an update will break things) as a temporary solution? Maybe for others that have this problem?

Something like using the field_key instead of the field_name?

February 26, 2024 at 12:29 pm #15344159

Osama Mersal
Supporter

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

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

Hi,

Thanks for your reply. I consulted our ACFML team; unfortunately, that's an ACFML limitation for now.

ACF does use field_keys, but everyone else does not. WPML, for instance, handles names of custom fields as they are stored in meta tables.

Best regards,
Osama

February 26, 2024 at 4:20 pm #15345342

simpleT

Unfortunate that the feature from ACFML does not solve this problem but it is what it is.