In WordPress, user accounts have fields for information like the name, nickname, biography, and more. WPML allows you to translate this user meta information.
Before starting, make sure you have the String Translation add-on installed and activated. Then, go to WPML → String Translation to enable user meta translation. Scroll down to the More options section, click edit, and choose the user roles you would like to make translatable.
To translate the user metadata:
Return to the top of the WPML → String Translation page, select In Domain: Authors, and click Search. The list should now display the names of the fields available for translation, followed by a number. This number represents the ID of the user the string belongs to.
Click the plus icon for the user string and language you want to translate and enter the translation.
Certain fields, such as first name, last name, website, and bio will not be visible in your String Translation table until you modify them. Return to Users → Profile and make a small change to the fields, such as adding a space or word. Save your changes to add the strings to the String Translation table.
Translating Custom User Fields
By default, the only user fields you can translate are first_name, last_name, nickname, description, and display_name.
To make custom user fields translatable, you need to add a WPML filter to your theme’s functions.php file. We recommend using a child theme for this because otherwise, your changes will be overwritten the next time you update your theme.
In the following example, we make our custom user field “Position” translatable (we use the field’s slug):
To make more custom user fields translatable, you can repeat this same code as many times as needed. Just make sure to use the correct field slug for each field.
Displaying User Metadata Translations on the Front-end
You can use the following function to display translations of user fields on the front-end: