WPML Advanced Custom Fields Multilingual
In its most simplest form, ACF is a UI for saving custom field values to a post object and because most multilingual plugins will create a new post for each translation, it is easy for ACF to work alongside your multilingual website without any configuration needed.
The WPML plugin works well with ACF. Here are some instructions and tips to make sure your website runs smoothly:
1. Enable field group translation
Before creating a field group, please enable the “Field Groups” post type for translation. This is possible via the WPML -> Translation management page.
The option for “Fields” has been hidden in recent versions of ACF, but if visible, please leave “Fields” as “Do nothing” as to avoid conflicts when loading fields.
2. Translate field groups
Each language will require it’s own translation of a field group. The easiest workflow is to create your field group in the default language and then use the ‘Duplicate’ tool to create a duplicate field group in the new language. You can then edit the field’s label, settings but the field’s name must remain constant across all translations. This is because ACF uses the field’s name to save it’s data.
3. Editing a post
When editing a post, only the relevant language field groups will be loaded.
To make a translation of the post, you may use the same ‘Duplicate’ tool as above, but be sure to click the ‘Translate Independently’ button to prevent the translated post’s custom fields from being modified by the original post.
4. Avoid data loss
When editing a post, WPML will display a metabox containing a list of all custom fields and options to ‘Translate’ or ‘Copy’ the data. These settings can prevent ACF from correctly saving data so it is important to understand when to use them.
The ‘Copy’ setting will (upon update of the post) copy across the original post’s value and replace the translated post’s value. Please note that this setting does not change to ‘Translate’ after the post has been saved, so if you have selected ‘Copy’, ACF will not be able to save a unique value for the translated post.
The ‘Translate’ setting will do nothing, and allow ACF to correctly save the custom field data to the post.
You will notice that WPML shows hidden custom field values such as ‘_image’. These should not be copied as the value relates to a field and because each field is different for each translation, these should also be. In short, ignore the underscore fields and leave as ‘Translate’