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.