Skip to content Skip to sidebar

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 5 replies, has 0 voices.

Last updated by Otto 7 months, 1 week ago.

Assisted by: Otto.

Author Posts
October 6, 2025 at 12:57 pm #17460745

lorenzo

Background of the issue:
I have a custom taxonomy associated with users, and the primary language is Italian. I am trying to ensure that when I change a user-term association in one language, it replicates in other languages.

Symptoms:
When I flag a term for user X in language Y, the user is not flagged for the same term in all languages.

Questions:
Is there a way to synchronize custom taxonomy terms across all languages for users?

October 6, 2025 at 3:33 pm #17461368

Otto

Hello,

There is no standard feature to keep the translated taxonomies in sync.

This workaround may help, though:
Avoid cross-language mirroring by design: set the taxonomy to “Not translatable” and translate display labels only

- In WPML → Settings → Taxonomy Translation, set your user taxonomy to Not translatable, so there is only one canonical set of terms site-wide.

- Display localized labels (term names) via String Translation or custom gettext filters, while the underlying term remains the same across languages.

This removes the need to mirror relationships; the same term applies to all languages, and only the label changes.

Best Regards,
Otto

October 7, 2025 at 1:07 pm #17463930

lorenzo

Hello, and thank you for support.

I dont understand the second point:
--- Display localized labels (term names) via String Translation or custom gettext filters, while the underlying term remains the same across languages.
Can you please explain it again?

Thank you

October 7, 2025 at 3:03 pm #17464329

Otto

Hello,

I am sorry I wasn't clear enough.

As explained, there is no way to keep taxonomies automatically in sync. You'll need to send the content to translate again in order to make the change in the other language.

So, I suggested setting the taxonomy as not translatable and translate the labels using string translation. This will need some coding and will depend on how the taxonomy labels are used in your template.

This will need some custom coding that it's outside the scope of our support. I was just pointing a possible solution.

Best Regards,
Otto

October 8, 2025 at 8:39 am #17466300

lorenzo

Hello Otto,
I understand everything but still not when you say "translate the labels using string translation". What do you mean by "labels"?
Please you don't have to explain the coding procedure (i am a developer) just be kind and clarify for me what do you mean with "labels".
Thank you

October 8, 2025 at 12:42 pm #17467316

Otto

Hello,

Sure 🙂

But take into account that this is just an idea. The feature you need is not a standard WPML so I am just sharing this to illustrate what I mean, I didn't test it nor we can't implement it nor maintain it.

As suggested, set the taxonomy as not translatable.

Then, register each term’s display label as a translatable string

When a term is added/updated, register its default-language name with WPML String Translation. Then you’ll provide the label for each language there.

add_action('created_my_tax', 'my_tax_register_label_string', 10, 2);
add_action('edited_my_tax',  'my_tax_register_label_string', 10, 2);

function my_tax_register_label_string( $term_id, $tt_id ) {
    $term = get_term( $term_id, 'my_tax' );
    if ( is_wp_error( $term ) || ! $term ) return;

    // Register the default label as a string.
    do_action(
        'wpml_register_single_string',
        'User Taxonomy Labels',                       // context
        "my_tax_term_{$term->term_id}_name",          // name
        $term->name                                   // value (default language)
    );
}

Go to WPML → String Translation, filter by context “User Taxonomy Labels”, and add translations for each my_tax_term_{ID}_name.

In order toutput the localized label instead of $term->name

Create a helper you’ll use wherever you display user terms:

function my_tax_label( WP_Term $term, $lang = null ) {
    // Optional: force a language; otherwise WPML uses current lang.
    if ( $lang ) do_action( 'wpml_switch_language', $lang );

    $label = apply_filters(
        'wpml_translate_single_string',
        $term->name,                              // fallback
        'User Taxonomy Labels',
        "my_tax_term_{$term->term_id}_name"
    );

    if ( $lang ) do_action( 'wpml_switch_language', null ); // restore
    return $label ?: $term->name;
}

In the front end, you'll need to use it this way:
[php]
$terms = get_terms( ['taxonomy' => 'my_tax', 'hide_empty' => false] );
foreach ( $terms as $term ) {
echo esc_html( my_tax_label( $term ) ); // shows localized label
}
[php]

If you already have code that prints $term->name, just replace it with my_tax_label( $term ).

Best Regards,
Otto