If we have a term_meta named icon which gets an integer and is set to copy when you translate a term with this meta programmatically it won't get copied to the translated term.

        $ok = wp_insert_term("s", "feature");
        update_term_meta($ok["term_id"], "icon", 54);
        $ok2 = wp_insert_term("س", "feature");
        $taxonomy = "feature";
        $wpml_element_type = apply_filters("wpml_element_type", "feature");
        $originalElementId = get_term($ok["term_id"])->term_taxonomy_id;

        global $sitepress;
        $trid = $sitepress->get_element_trid(
            "tax_" . $taxonomy
            "tax_" . $taxonomy,

        $ttid = apply_filters(

//        wp_update_term($ok2["term_id"], $taxonomy, []);

the output is:

WP_Term]8;;file:///Volumes/HDD/Websites/central-graphql/wp-includes/class-wp-term.php#L18\^]8;;\ {#7032
  +term_id: 196
  +name: "س"
  +slug: "%d8%b3"
  +term_group: 0
  +term_taxonomy_id: 174
  +taxonomy: "feature"
  +description: ""
  +parent: 0
  +count: 0
  +filter: "raw"
array:1 [
  "icon" => array:1 [
    0 => "54"

I used this in phpunit, it shows the term meta is not copied.

1 Answer 1


The trick is the update the original term.

wp_update_term($term_id, $taxonomy, []);

This will trigger the WPML actions that sync the meta, notice we provided [] so technically we are not updating anything but this is good enough to trigger the sync.

  • Also don't forget to clear the term_meta cache for that translated term after the term_update. Commented Dec 31, 2022 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.