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
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.
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
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.
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.
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.
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)
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.
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? 😊
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:
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.
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 😊
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.