When using the Advanced Custom Fields plugin with WPML, you can keep multilingual posts and pages using custom fields fully independent from each other. You can do this by translating the custom field content using the WordPress native editor.
If you want to learn how to translate regular custom fields, see our documentation page about Translating Sites Built with Advanced Custom Fields (ACF).
Before getting started, make sure to install and activate the Advanced Custom Fields, WPML core, WPML String Translation, and Advanced Custom Fields Multilingual plugins.
The Advanced Custom Fields plugin is highly flexible, making it possible for you to use custom fields to add data to your WordPress posts in different ways.
For example, the Flexible Content field allows you to add groups of subfields, also known as layouts, and fully control their order.
For a multilingual site, you may want to create a Flexible Content field with a different number of subfields in each language. In cases like this, you could say that each language follows a different structure.
WPML allows you to choose from four translation preferences:
- Copy Once
- Don’t translate
You can set the translation preferences by going to WPML → Settings and scrolling down to the Custom Fields Translation section.
If you want your Flexible Content field to have a different number of subfields in each language, you should use the Copy Once option. So, your Flexible Content field as well as any Repeater fields and subfields within it should all be set to Copy Once.
Because the Copy Once option only copies the initial custom field values and structure, you can then manually modify the fields in other languages as needed.
To learn more about the translation preferences you can use for each custom field when setting up a site with different custom field structures across languages, see the page about Recommended Custom Fields Translation Preferences for ACF and WPML.
However, any custom fields set to Copy Once are not visible in WPML’s Advanced Translation Editor. This means that to achieve different custom field structures across languages, you need to translate the content using the WordPress native editor. This requires you to switch WPML’s Advanced Translation Editor off.
To do this:
- Edit the post or page with the custom fields assigned to it.
- In the Language box in the right sidebar, switch Use WPML’s Translation Editor to Off.
- Click the Update button at the top of your post or page.
Once you set the translation preferences of your custom fields to Copy Once and turn off WPML’s Translation Editor, you can move on to creating posts with different custom field structures in different languages.
- On the Edit screen of your post or page, scroll down to the Synchronise translations section. Uncheck the box next to Synchronise repeater and flexible sub-fields positions in post translations.
- In the Language box, click the plus icon next to the secondary language you want to translate your page into.
- You’ll be taken to a completely blank page. Add the title of the page in your secondary language and click Publish.
- Refresh the page you just published in the secondary language. You should now see all the custom field values you added in your site’s default language.
- You can now add, edit, remove, and reorder layouts and custom fields in your secondary language according to your needs. Once you’re done, click Update.
Now, take a look at your page edit screens in both the default and secondary languages. Both language versions should be fully independent from each other, with different layout structures and different custom field values.
Custom field structure in the site’s default language
Custom field structure in the site’s secondary language
If you are using Flexible and Repeater fields and want to translate the field values while maintaining the same layout structure across all languages, see the page about Translating ACF Repeater and Flexible Content Fields with WPML.