WPML Translating a term/taxonomy programmatically

I have all terms in English and I am creating/duplicating the same ones for German language by using foreach on english terms and this way i create all terms for German language.

The problem is when i need to assign an German term to its English version.

I tried the trick with TRID like this:

$trid = $sitepress->get_element_trid($englist_term_id, “taxonomy_name”);

$sitepress->set_element_language_details($new_term_id, “taxonomy_name”, $trid, $lang_code, $sitepress->get_default_language());

The problem is that $trid does not take any value (The first line of the above code)

Probably there is some other way to accomplish this!

Read more here:: WPML Translating a term/taxonomy programmatically

Leave a Reply

Your email address will not be published. Required fields are marked *