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 5 replies, has 0 voices.

Last updated by jeremiahH 1 week ago.

Assisted by: Otto.

Author Posts
February 5, 2025 at 11:00 pm #16673174

jeremiahH

Background of the issue:
I'm trying to send in translations for our pages, but it is not picking up the ACF fields. We are using the Advanced Custom Fields Multilingual plugin and have turned on the ACF fields needed to the setting, 'Same Fields Across Languages' so that each ACF field is translatable. We are using acf-json, and we found this ticket which might be related: https://wpml.org/forums/topic/acf-blocks-not-appearing-in-wpmls-translation-editor/. We are in communication with Ahmed within WPML support, and he has credentials to our site. Link to a page where the issue can be seen: hidden link. When I click on the page, it shows only 24 words are available to translate, which we found is some metadata we have for the page.

Symptoms:
WPML is only grabbing the meta data and not the ACF content to be translated. Our theme uses majority ACF fields.

Questions:
Why is WPML not picking up the ACF fields for translation?
Do we need to specify the wpml_cf_preferences key in the acf-json files?

February 6, 2025 at 12:57 pm #16675593

Otto
Supporter

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

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

The issue you are experiencing with Advanced Custom Fields (ACF) when using the acf-json feature might be related to WPML not properly saving translation preferences in the JSON files.

Let's try a few things to narrow down the issue and solve it:

1. Check for the `wpml_cf_preferences` key in JSON files:
- Open the JSON file corresponding to your field group in the `acf-json` folder of your theme.
- Ensure that each field in the group has an entry for `"wpml_cf_preferences"` with the appropriate value for translation.
- Example for a field that should be translatable:

     {
       "key": "field_123456",
       "label": "Field Name",
       "name": "field_name",
       "type": "text",
       "wpml_cf_preferences": 2
     }

- Values for `wpml_cf_preferences`:
- `0`: Not translatable
- `1`: Copy
- `2`: Translate
- If this key is missing, add it manually with the appropriate value.

2. Sync the field groups after making changes:
- After modifying the JSON files, go to your WordPress admin panel.
- Navigate to Custom Fields > Field Groups.
- If any field groups require synchronization, you will see a notification at the top.
- Click "Sync" to ensure changes in the JSON files are reflected in the database.

3. Temporarily disable the `acf-json` feature:
- If issues persist, try disabling the acf-json feature by renaming or removing the `acf-json` folder in your theme.
- Then, in WordPress admin, edit and save your field groups again so they are stored directly in the database.
- This can help determine if the issue is caused by fields being loaded from JSON instead of the database.

Users have reported that the ACF Local JSON feature can interfere with the translation of field labels when using WPML. Disabling this feature will allow the fields to be stored directly in the database, which can help determine if the issue is related to fields being loaded from JSON files instead of the database. Additionally, it's important to note that the ACF Local JSON feature does not generate separate JSON files for each language. This means that when distributing fields using acf-json, the fields for secondary languages may not be properly included, leading to translation issues. Therefore, temporarily disabling the acf-json feature can help identify if it's contributing to the problem you're experiencing with ACF fields not being recognized by WPML.

For further details on ACF and WPML compatibility, check this documentation:

ACFML 1.9 – Support for Importing and Exporting Translated Custom Fields

Let me know if this points you in the right direction, please.

Best Regards,
Otto

February 6, 2025 at 5:32 pm #16676761

jeremiahH

We were playing around with the site and found that saving the page updated the word count.

February 6, 2025 at 8:27 pm #16677220

jeremiahH

Hi, our ACF field values are now showing up in the translation file, however we are also getting the ACF field labels as separate strings. We have ACF Field Groups set as Not Translatable, but they are still being included. We do not want to include the labels for translation. How can we get these removed from translation?

In WPML settings, I've confirmed all field groups in the ACF plugin are set to Not translatable and as well as in the WPML settings. (See screenshots).

Screenshot 2025-02-06 at 2.24.57 PM.png
Screenshot 2025-02-06 at 2.26.00 PM.png
February 6, 2025 at 9:22 pm #16677382

Otto
Supporter

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

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Thanks for the update.

I am not sure I am getting the issue correctly, I need to take a deeper look.

To do so, I created a fresh WP install with WPML and its add-ons and ACF Pro.

You can log in to it by following this link:
hidden link

Can you please recreate the issue there? I think you'll need to upload your custom theme or at least import the acf-json file. Feel free to install anything else if it's needed to see the problem, but let's try to keep it to the bare minimum so it's easier to isolate the problem.

Thanks for your cooperation!

Best Regards,
Otto

February 7, 2025 at 1:33 pm #16680048

jeremiahH

I'll try to be more clear on what the issue is.

We submitted the homepage for translation from WPML to BLEND, the translation service we are using, and they were able to isolate the strings coming from WPML in the .xliff file and send over as spreadsheet.

As you see in the screenshot, outlined in red, are the field labels for all of the ACF fields. We do not want these to be submitted in the .xliff file for translation.

Screenshot 2025-02-07 at 7.24.01 AM.png
February 7, 2025 at 2:35 pm #16680215

Otto
Supporter

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

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Thanks for the explanation.

If you don't want to translate the field labels, please include the following in your site's wp-config.php file:

define( 'ACFML_EXCLUDE_FIELD_GROUP_STRINGS_IN_POST_JOBS', true );

References:

https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/translating-acf-field-labels-with-wpml/#excluding-field-labels-from-the-advanced-translation-editor

https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/acf-multilingual-acfml-constants-and-hooks-reference/#acfml_exclude_field_group_strings_in_post_jobs

Let me know if it helps, please.

Best Regards,
Otto

February 7, 2025 at 6:27 pm #16680838

jeremiahH

Thanks, Otto! That did the trick! Appreciate your help on this.