Skip Navigation

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

Problem:
You need to translate a Meta Box Post field under a User profile and select a Custom Post Type (CPT) 'franchise' for every translation of your WordPress website.
Solution:
First, ensure that you unset or set as 'Not translate' any of the mb- type of options in WPML > Settings.
Next, add the following code to your functions.php file to make the 'franchise_associated' user custom field translatable:

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

Then, navigate to WPML > String Translation. Search for 'franchise_associated' and translate the CPT numerical id. For example, in the provided Sandbox site, translate from 68 to 70.
For detailed guidance, review the documentation on Translating User Meta Information with WPML.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/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.

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Lauren 5 months ago.

Assisted by: Lauren.

Author Posts
August 30, 2024 at 5:22 pm #16125921

adrienR-5

Background of the issue:
I'm trying to understand how can I have a translation of a Meta Box Post field under a User profile. Inside my WordPress account profile: hidden link My Meta Box group field: hidden link & hidden link Basically for a WP user account I would need to be able to select a CPT 'franchise' for every translation of my WordPress website.

Symptoms:
None specified.

Questions:
How can I translate a Meta Box Post field under a User profile?
How can I select a CPT 'franchise' for every translation of my WordPress website?

September 4, 2024 at 5:51 pm #16142203

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

I have tried multiple configurations in the translation settings. I got it to where it would save Spanish and not revert to English when saving the profile in Spanish, but when switching back to English, the Franchise associated field is once again blank. So I have escalated this to our compatibility team so that they can look further into it. I'll update here once I have more information.

September 10, 2024 at 2:00 pm #16162021

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Please review the following document:
https://wpml.org/documentation/getting-started-guide/string-translation/translating-user-meta-information-with-wpml/

According to that:

Unset/set as Not translate any of the mb- type of options in WPML > Settings.

Add this code into your functions.php file, where franchise_associated is the user custom field.

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

Go to WPML > String Translation.

Look for franchise_associated.

Translate the CPT numerical id. In the example provided in the SandBox site (hidden link) it would be translated from 68 to 70.

Please let me know if this resolves the issue for you.

September 10, 2024 at 2:13 pm #16162090

adrienR-5

Well, first of all having to manually add the ID is not something I want.

I want a visual way to attach a Franchise (regarding his language) to a WP Account profile.

Ideally I would like to have a way to set whatever post I want in each of my languages (under my WP account), so not directly the direct translation of the franchise I choose in other language.

Hope it make sense.

Thanks.

September 10, 2024 at 4:05 pm #16162761

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Per our documentation, this is currently the only way to translate the user meta fields using WPML. If you need it to work a different way, it will require custom programming. We have some great contractors that may be able to help you, feel free to contact them using this link: https://wpml.org/contractors/