The compatibility with ACF Pro is provided by Polylang Pro. This integration is available only for post types and taxonomies. It does not work yet for options pages (this is planned for a future version). There is however an integration contributed by the Be API Agency to achieve that, see: https://github.com/BeAPI/acf-options-for-polylang.
- Before you start
- Activate the Field Groups translation
- Translate a Field Group
- Polylang makes a smart copy
- Activate the custom fields synchronization
1. Before you start
The first question to ask yourself is: “Do I need to translate the label and the instructions?”
If yes, thus you need to translate your field groups in all your languages. If not, it is preferable not to translate your field groups.
2. Activate the Field Groups translation
Go to Languages > Settings > Custom post types and Taxonomies and activate the translation as shown here:
3. Translate a Field Group
Go to Custom Fields > Field Groups.
As you see in the following screenshot, the field groups are now translatable. Before translating your field groups you need to activate the duplicate tool as below, it will allow you to copy all the content from the source field group to the translation.
We recommend you to create entirely your field group with the wanted custom fields before translating it. Indeed there is no synchronization between the translated field groups. It means that a modification made for example in the English field group won’t impact its French translation.
Once you have duplicated your field group into another language, you just need to edit new field group to translate the label and the instructions.
4. Polylang makes a smart copy
When translating a content (post, page, taxonomy …) in another language, Polylang decides which custom fields must be copied and which ones must be translated. The ones which must be translated are image, file, gallery, post object, relationship, page link and taxonomy. It means that Polylang prefills the field with the correct translation when creating new translations. This also works when these custom fields are included in repeater fields. If the translation doesn’t exist Polylang will keep the value as is.
This smart copy works in the same way whether the fields groups are marked as translatable or not in Custom Fields > Field Groups.
5. Activate the custom fields synchronization
It is possible to synchronize the custom fields across the translations. As a reminder, ‘synchronization’ means that a modification made in a post impacts all its translations.
You can activate this synchronization by checking the “custom fields” option in Languages > Settings > Synchronization module. See: Synchronize metadatas between translations
Polylang synchronizes the translated values of custom fields
If you decide to modify a translated value from a custom field, Polylang will automatically synchronize the custom field of all the other translations. In the example below we set the English value of a post object field to “A post in English”. As you can see in the following screenshot its translated French value “Un article en Français” is automatically copied to the translated French post.
Polylang synchronizes the untranslated value of custom fields
If you decide to modify an untranslated value from a custom field, Polylang will copy this value to the other translations. In the example below we set the English value of a post object field to a post not translated in French. As you can see below Polylang has copied the untranslated English value into the French translation.
Polylang synchronizes the copied custom fields
If you modify a copied value (text, number, email, url custom field …) for example in a French post, Polylang will automatically keep this same value in the translated English post.
A modification made on the layouts (group, repeater, flexible content) will impact the translations. For example, if you choose to add a flexible content in a French post, Polylang will automatically add this flexible content to the translated Englih post. It’s the same behavior if you decide to remove it.
Can I choose to synchronize or unsynchronize some specific custom fields?
By default, when checking the “custom fields” synchronization option, all the ACF Pro custom fields are synchronized. However you can choose the custom fields to synchronize or unsynchronize thanks to a wpml-config.xml file. See our documentation: The wpml-config.xml file