If you’re running a multilingual WordPress site or looking to get started with one, you’ll also want to translate data from your custom fields. You can easily achieve this with ACFML (ACF Multilingual), a glue plugin that works together with WPML to translate ACF fields. ACF Multilingual lets you translate everything from custom field values to labels, titles, and labels for Choices. What’s more, you can choose from different translation workflows, depending on how simple or complex your custom field setup is.
To get started, install and activate the following:
- WPML core plugin and the WPML String Translation add-on
- Advanced Custom Fields Multilingual (ACFML) glue plugin
- WooCommerce Multilingual add-on (if you’re running a WooCommerce site)
I’ll assume that you’ve already gone through the WPML setup wizard. If not, you can check out WPML’s guide to getting started.
Next, go to ACF → Field Groups and edit the field group you just created. At the top of the screen, you can see the ACF Multilingual setup wizard, which lets you choose from three translation options for your custom field group. You can check out the differences between each translation option and pick whichever is right for your case.
For demonstration purposes, I’ll select the Same fields across languages translation option.
Now, you can head over to the editing screen of the post type your custom fields are attached to. In the right sidebar, you’ll see a Language box. Click the plus icon next to the language you want to translate your post type and the attached custom fields into.
This takes you to the Advanced Translation Editor, where you should see all your text field values, titles, and labels available for translation. You can choose between automatically or manually translating the post content and custom field data.
It’s worth noting that numeric values, like the Mobile Price, won’t appear in the Advanced Translation Editor. In the Same fields across languages option, these and all other numeric values are automatically copied over to your secondary language content.
Once you’re done translating, simply hit the Complete button. If you’ve already added the functions mentioned in the section about displaying the data, you don’t have to do anything more. WPML automatically creates the post type in your second language and connects it to the one in your default language.
To know more about how to use Advanced Custom Field with Astra theme, check out the documentation here.