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.

Sun Mon Tue Wed Thu Fri Sat
- - 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Supporter timezone: America/Lima (GMT-05:00)

Tagged: 

This topic contains 1 reply, has 0 voices.

Last updated by Andreas W. 2 weeks ago.

Assisted by: Andreas W..

Author Posts
September 17, 2025 at 5:57 pm #17410969

Vincent Dagenais

Background of the issue:
I'm creating a translatable product using WooCommerce and programmatically creating products. I need to set custom taxonomy to the original product and translated product and link them together.

Symptoms:
I need help attaching custom taxonomies to products.

Questions:
How do I attach custom taxonomies to both original and translated products?
How can I link custom taxonomies between original and translated products?

September 18, 2025 at 6:32 am #17411647

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

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

Hello Vincent,

Thanks for your question. To attach custom taxonomies to both original and translated products, you’ll want to:

Assign the taxonomy term to the original product using wp_set_object_terms().

Use WPML’s wpml_object_id filter to retrieve the translated term ID for each language.

Assign the translated term to the translated product using the same function.

Example:

$translated_term_id = apply_filters( 'wpml_object_id', $original_term_id, 'your_custom_taxonomy', false, $target_lang );
wp_set_object_terms( $translated_product_id, array( $translated_term_id ), 'your_custom_taxonomy' );

The hook:
https://wpml.org/wpml-hook/wpml_object_id/

Also, make sure your custom taxonomy is marked as “Translatable” in WPML settings and translated at WPML > Taxonomy Translation.

Best regards
Andreas

The topic ‘[Closed] i’m creating a translatable product and need help attach custom taxonomies’ is closed to new replies.