Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing an issue where the translated 'last_name' string of user meta in WPML is not visible on the frontend; only the default translation is shown.
Solution:
If you're facing a similar issue, first confirm how the user field was created. If it was created via ACF, check the translation settings of this field. Follow the guide on translating custom user fields with WPML, which can be found here: Translating Custom User Fields.

Add the following code to your functions.php to make the field translatable:

add_filter( 'wpml_translatable_user_meta_fields', function( $fields ) {<br />   $fields[] = 'tittel__stilling';<br />   return $fields;<br />} );

To display this translated string on the frontend using Elementor, add this code to your functions.php:

function wpml_translated_author_text() {<br />    $author_id = get_queried_object_id();<br />    $text = get_the_author_meta('tittel__stilling', $author_id);<br /><br />    return esc_html($text);<br />}<br />add_shortcode('author_text', 'wpml_translated_author_text');

Then, use the shortcode [author_text] in your Elementor template to display the translated string.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at WPML Known Issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If issues persist, please open a new support ticket.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 10 replies, has 0 voices.

Last updated by Dražen 1 month, 2 weeks ago.

Assisted by: Dražen.

Author Posts
June 3, 2025 at 1:34 pm #17102614

nicolasP-67

Background of the issue:
I am trying to translate the last_name string of user meta in WPML, and I managed to translate it. However, the different translations are not being shown on the frontend, only the default one. Here is a video demonstration: hidden link. The issue can be seen on this page: hidden link. Let me know if you need wp-admin access.

Symptoms:
The translated last_name string is not visible on the frontend; only the default translation is shown.

Questions:
How can we fix the issue of the translated last_name not appearing on the frontend?

June 3, 2025 at 1:43 pm #17102657

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

you have left the chat, so I have converted this to a ticket. We can continue here or you can open new chat as it might be quicker to resolve your issue.

Can you share more info how are you showing this string on that page in default language? Via some template or PHP or?

Let me know.

Thanks,
Drazen

June 3, 2025 at 3:37 pm #17103236

nicolasP-67

Hi

Thanks for that

Its an elementor theme builder page, an uthor page, with a dynamic tag on the text field widget.

I added a loom video to demonstrate:

hidden link

Please do share a private form reply if you need me to add wp admin credentials for furhter troubleshooting

Regards

June 4, 2025 at 6:39 am #17104546

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back.

1) Can you just confirm how did you create this user field, via ACF? If so, what is translation settings of this field?

2) If you are adding it via custom code, did you check and follow our next guide:

- https://wpml.org/documentation/getting-started-guide/string-translation/translating-user-meta-information-with-wpml/#translating-custom-user-fields

3) Sure, please share admin access, so I can take a look. Make sure to have a backup.

Regards,
Drazen

June 4, 2025 at 10:25 am #17105819

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks, I have checked further and it seems even if it is ACF you need to use approach from the guide I shared and add that custom field for translation and then translate via WPML > String translation.

I have added code to your function.php and translated text:

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

Now 2nd part is showing this translated string, there is also code for that in guide.

- https://wpml.org/documentation/getting-started-guide/string-translation/translating-user-meta-information-with-wpml/#translating-custom-user-fields

Since you are using Elementor I adjusted it a bit, so please add next code to your functions.php

function wpml_translated_author_text() {
    $author_id = get_queried_object_id();
    $text = get_the_author_meta('tittel__stilling', $author_id);

    return esc_html($text);
}
add_shortcode('author_text', 'wpml_translated_author_text');

Then in Elementor template you can use short code [author_text] to show this translated string / author field.

I tested on my local website, and it works fine.

Regards,
Drazen

demo – Sandbox.jpg
June 4, 2025 at 11:29 am #17106100

nicolasP-67

Hi

Please check if everything is ok?

i added the 2 snippets

i translated the acf field in strings.

I added the dynamic shortcode in author page (elementor)

But seems like spanish and polish is not working?

only no and es?

hidden link

hidden link

June 4, 2025 at 12:15 pm #17106224

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

you made a change in default language Elementor template, but have not re-translated it. I have done so, and now it works fine.

hidden link

Regards,
Drazen

June 4, 2025 at 1:45 pm #17106734
nicolasP-67

Thanks Dražen, not sure what u did, but it works!

There is one last issue i encountered earlier today...

I have had issues with this post:
hidden link

When i made translations with the automatic translator, the post were not visible in the designated new language.

I translated it, but when i clicked the language switcher to find it in the posts area, it was not to find? its weird cause, its only for that specific post? Not sure what happened?

Do we delete the existing translations, and then add new? Whats the root cause of the issue?

As per right now i have this issue: cannot translate post at all:
hidden link

Looking forward to hearing from you!

New threads created by Dražen and linked to this one are listed below:

https://wpml.org/forums/topic/split-post-not-translated/

June 5, 2025 at 6:44 am #17108676

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back.

We limit 1 issue per ticket to keep things clear. This will help other users with similar problems to find solutions when searching the forum.

I have opened a new ticket for you:
- https://wpml.org/forums/topic/split-post-not-translated/

I will be closing this ticket now since seems no more doubts about the topic.

Regards,

Drazen

June 5, 2025 at 7:19 am #17108768

nicolasP-67

Understand.

Thanks alot for the help!

June 10, 2025 at 8:30 am #17120770

daniloT-4

Zdravo Dražene..nadam se da mogu da pišem na lokalnom jeziku. Da li možeš da mi daš kontakt finansija pošto mi treba neka korekcija na fakturi koju smo dobili od vas?

June 10, 2025 at 8:32 am #17120783

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello @danilot-4,

please open new ticket when you need help, since usually we do not reply to closed tickets.

You can contact our admin team via next form:

- https://wpml.org/home/contact-us/contact-form/

Regards,
Drazen