Skip Navigation

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

Problem:
The client is trying to translate only one specific field (the country field) in a custom post type called 'Resellers' while keeping the rest of the fields unchanged across translations.

Solution:
If you're experiencing this issue, we recommend the following steps:

1. Go to ACF → Field Group and open the Field group that contains the field you want to translate.
2. Click on the "Change Option" link to modify the Translation mode at the top.
3. Select "Expert" mode.
4. Scroll down to the field you wish to translate and set the translation Preference to "Translate".
5. For the rest of the fields, set the translation preference to "Copy".
6. Save the changes.

If you have set up the fields programmatically, use the

wpml_cf_preferences

key with the value 2 for the field you want to translate, indicating that it is translatable. For fields you do not want to display in the translation editor, assign a value of 0 or 1 to the

wpml_cf_preferences

key.

For more details, please refer to our guide on translating ACF blocks with WPML.

Please note that this solution might be irrelevant if it's outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues at https://wpml.org/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 in our support forum.

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 9 replies, has 2 voices.

Last updated by Prosenjit Barman 1 year, 4 months ago.

Assisted by: Prosenjit Barman.

Author Posts
January 17, 2024 at 11:16 pm #15197380

magnusT-5

Tell us what you are trying to do?
I have a custom post type - Resellers. For each post we add and then we want to translate do we only want to translate ONE field. The country field. Rest of the field and its information do I always want to be copied over.

Is there any documentation that you are following?
I have used the WPML documentation but it seems that I can't only get one field to be translated in the translation view.

I have a video i've recorded that also explains what I want to do. Take a look at it here: hidden link

January 18, 2024 at 11:37 am #15199501

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thanks for contacting WPML Support.

Thank you for providing the video. It has given me a good understanding of your requirements. To display a specific field in the translation editor while excluding others, you should switch the Translation mode of the Field group to 'Expert'. Following that, adjust the translation setting of the desired field to "Translate" and set the option for the remaining fields to "Copy".

To modify the translation preference of certain fields properly, I recommend the following steps.

- Navigate to "ACF → Field Group" and open the Field group which includes the specific field.
- At the top, there is an option to modify the Translation mode. Click on the "Change Option" link there.
- Choose the "Expert" mode from the available options.
- After selecting "Expert" mode, scroll down to the field you wish to see in the Translation editor
- Set the translation Preference to "Translate" and save the changes.
- For rest of the fields, set the translation preference to "Copy" as you want the same information to appear in other languages.
- Save the changes.

Once done, please make a small change in the default post, save the changes, and then try to update the translation. I hope it will help. Please feel free to let me know if you need further assistance. I will be happy to help.

Best regards,
Prosenjit

January 18, 2024 at 4:16 pm #15201327

magnusT-5

Hello Prosenjit,

Thank you so much for your reply 😊
However I have all my ACF field groups as acf.php file that is pushed up to production. So on the production environment don't I have the ACF field group visual view.

How do I then?

January 19, 2024 at 5:12 am #15202869

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thank you for the clarification.

If you've set up the fields programmatically, there's a solution for that as well. You can use the `wpml_cf_preferences` key for any field you wish to make visible in the translation editor and assign the value 2 to this key. The value 2 signifies that the field is translatable. For fields that you prefer not to display in the translation editor, you should assign a value of 0 or 1 to the "wpml_cf_preferences" option.

For a clearer understanding, please check this guide: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/translating-acf-blocks-with-wpml/#preparing-programatically-registered-fields-for-translation

I hope it will help. Please feel free to let me know if you need further assistance in this matter. I will be happy to help.

Best regards,
Prosenjit

January 24, 2024 at 5:11 pm #15223091

magnusT-5

I have now added "wpml_cf_preferences" to one field in a field group with many fields.
However when I go to the admin area and then I still don't have any translation flag on each post to translate it to english (and copy the rest of the acf fields values that is in each post (except the one we want to translate) since they are the same no matter what language)

no translation flag.png
added wpml cf.png
January 26, 2024 at 8:43 am #15229052

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thank you for the update.

It seems you are trying to translate posts within the 'Employee' post type. However, according to the WPML Debug Information, the translation preference for the 'Employee' post type is currently set to 'Not Translatable'. This is the reason why the icons for translating these posts are not appearing.

To translate them, please try the following.

- Please go to "WPML > Settings" and scroll down to the "Post Type Translation" section.
- Locate the "Employee" post type and change the translation preference of the post type to "Translatable"
- Save the changes and check the Employee section.

You should now be able to translate the post properly. If the translation preference for the fields is set correctly, the field data will appear in the translation editor for translation.

Let me know if that helps or if you need further assistance in this matter. I will be happy to help.

Best regards,
Prosenjit

January 28, 2024 at 6:03 pm #15234611

magnusT-5

Hello,

Thank you for your help once again 😊
So it isn't possible to set that as well from code? That the custom post type Employee should be translated? In a similar way like we did for the field above? 😊

January 29, 2024 at 9:20 am #15236809

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi There,

I'm happy to help you with this issue.

Indeed, you can programmatically define translation preferences, but this involves creating a WPML Config file in your child theme and setting the translation options there. For guidance on crafting this config file, please refer to the following tutorial:

- https://wpml.org/documentation/support/language-configuration-files/#using-wpml-language-configuration-file-with-child-themes

Additionally, this guide will show you how to make a custom post type translatable in the WPML Config File: https://wpml.org/documentation/support/language-configuration-files/register-custom-terms-types-taxonomies-as-translatable/#custom-types.

While the above method is effective, it does involve a bit of coding. An alternative and possibly simpler approach might be to adjust the Translation preference directly through the WPML interface by navigating to "WPML > Settings > Post Type Translation". This route might be more straightforward if you prefer to avoid manual file edits.

If there is anything else if you need help with, please let me know. I will be happy to help.

Best regards,
Prosenjit

January 29, 2024 at 1:37 pm #15238530

magnusT-5

Thank you once again Prosenijt. I will take a look in the config file setting on how to do that but first I have the same recurring problem with WPML changing back which fields I want translted.

Please see this video:
hidden link

I change the value for some reseller_xxxx fields to COPY but when I then create a English version of a post I get all the fields I don't want to translate and I also can see in WPML -> Settings that the settings has changed back to TRANSLATE instead of COPY.

Looking forward to receive good help from you again 😊

January 30, 2024 at 7:25 am #15241655

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thank you for sharing the video.

I understand the issue you're having. Given that your ACF fields have been set up through the acf.php file, adjustments to their translation preferences via the WPML Settings interface won't be effective. These settings will revert to align with the configurations specified in your acf.php file.

To address this, please make sure that the "wpml_cf_preference" parameter for each relevant field in the acf.php file is assigned a value of '1'. This value indicates that the field content should be duplicated from the original language to its translations. For detailed guidance on configuring your programmatically registered ACF fields to work smoothly with WPML, I recommend reviewing this tutorial again: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/translating-acf-blocks-with-wpml/#preparing-programatically-registered-fields-for-translation

Let me know the update. I will be happy to help if you need further assistance in this matter.

Best regards,
Pros