Skip Navigation
Updated
May 23, 2022

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 WPMLString 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.

wpml-string-translation-user-translation
Enabling user meta translation

To translate the user metadata:

  1. Return to the top of the WPMLString 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.
  2. Click the plus icon for the user string and language you want to translate and enter the translation.
Displaying user strings available for 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):

add_filter( 'wpml_translatable_user_meta_fields', function( $fields ) {
   $fields[] = 'position';
   return $fields;
} );  

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:

get_the_author_meta( ‘slug-of-your-custom-user-field’, $user_id );

While there are other ways to get user meta, this is the only way to display translated user meta fields.