Translating custom fields is a necessary part of translating your WordPress site. Thanks to the help of plugins, this work becomes much easier. In this post, I will give you detailed steps to translate your custom fields with WPML plugin.
WPML is among the most popular plugins to translate custom fields. It doesn’t have a free version so you have to pay for it. After buying, follow these steps.
Step 1: Install and Activate WPML Plugin
First, you need to log in to your account here and download the WPML components: WPML Multilingual CMS, String Translation, and Translation Management. We need them to translate custom fields. Media Translation is not compulsory. Just use it if you want to translate media.
Then, install and activate the WPML components that you just downloaded and we’ll start to translate custom fields now.
Step 2: Set up Languages with WPML Plugin
You need to add your own language that you want to translate to first by going to WPML > Languages. You will see the Site Languages section where you set your own language. The default language is English. To add a new language, click Add/ Remove languages.
When the list of languages shows up, select the languages you want and click Save.
After saving, all the chosen languages here.
If you want to change the default language, click Change default language, and then select one from the list.
To edit the parameters of the display of the language, click Edit languages and you will see a table like this:
Step 3: Set up WPML plugin to translate custom fields
Now that you installed and activated all the necessary components, go to WPML > Settings. Then, scroll down till you find the Custom Fields Translation part.
In this part, you will see all the fields on your website. If you have lots of fields, you can use the search bar to find your wanted custom field as I did here.
Copy means that each time you update the field, the value in that field is automatically copied to the translated version without being translated. For example, the number of products doesn’t need translation so you should use this function.
Copy once is similar to Copy but it just copies the field’s value for the first time. Other times you update the field, it doesn’t do it. For instance, the field’s value in the original language is Available. This function makes a copy of it to the translated field, but next time you update the original field to Sold out, the translated field is still Available.
To translate the field that you want each time you update, choose Translate. For example, the field’s value is the promotion for each product so you need to use it to translate the field when you have a new promotion.
When finishing choosing the action for the fields you want, click Save.
Now, go to a post/page that you want to translate. Look at the fields you just chose above (in this case, my field is Order field) to see if you enter any value to them yet. If not, you won’t see the Custom fields section at the bottom.
So, you have to enter the value to the fields, then click Update post, reload the page. After that, you will see the Custom fields section here with the chosen actions:
Note that the actions for your fields here are similar to those in the previous step.
Step 4: Translate Custom Fields with WPML plugin
Now, in the right sidebar, there is a list of all the languages you just added. First of all, you need to turn on the WPML translation. Click the button next to Use WPML Translation Editor.
Choose the “+” button of the language you need to manually translate custom fields. Then, a new page where you translate custom fields appears. In the left tab of the Custom fields section lies the field’s content written in the original language. Your work is translating it to the right tab. When you complete translating, put a tick at the Translation is complete box and click Save & Close to go back to the Editor.
Besides the Custom fields section, you can translate other sections similarly.
Step 5: Show Translated Custom Fields on the Front End
If you preview this
post/page now, you won’t see the fields in the new language because you haven’t shown translated custom fields on the front end.
For convenient switching from one to another language, you should create a Menu language switcher.
Go to WPML > Languages, find the Menu language switcher section and click Add a new language switcher to a menu.
In this frame, you can set up and customize the menu. Click Save when you finish.
Now you have a new menu. Hovering your mouse to the menu items, you will see the list of languages in the drop-down menu. The Position column shows you where the current switcher is. To set up the current language switcher, click the pen symbol.
Now go to the front end, you’ll see the menu language switcher showing the language you translated in step 4. (Remember that it just shows the translated language, otherwise, other untranslated languages you choose in step 2 don’t appear here). Select the language you want and see the translated content of your custom fields.
It takes a bit time to manually translate custom fields post by post, page by page with WPML. But this will make your website more qualified compared to automatic translation.
WPML still has many other features. I hope that this tutorial is helpful for those who are still struggling with this plugin.
If you want to look for another translation plugin, don’t forget to take a look at our detailed reviewed of top 4 plugin to translate your site here.