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.

This topic contains 1 reply, has 2 voices.

Last updated by Bruno Kos 7 months, 1 week ago.

Assigned support staff: Bruno Kos.

Author Posts
March 6, 2019 at 4:23 pm #3280314

robertJ-2

I'm using the following code to output the ID's of all the related taxonomy terms. How can I output the taxonomy term names for each language instead? I thought I could just use

$term->name

but that doesn't output anything. Where am I going wrong?

<?php
  $taxonomy = "categories";
  $terms = get_terms( array(
    'suppress_filters' => false,
    'taxonomy' => $taxonomy,
    'hide_empty' => false,
  ) );

  if  ($terms) {
    foreach ($terms  as $term ) { ?>
      <p>
        EN: <?php echo $english = icl_object_id($term->term_id,'categories',false,'en'); ?><br />
        FR: <?php echo $french = icl_object_id($term->term_id,'categories',false,'fr'); ?><br />
        DE: <?php echo $german = icl_object_id($term->term_id,'categories',false,'de'); ?><br />
        IT: <?php echo $italian = icl_object_id($term->term_id,'categories',false,'it'); ?><br />
        RU: <?php echo $russian = icl_object_id($term->term_id,'categories',false,'ru'); ?><br />
        ES: <?php echo $spanish = icl_object_id($term->term_id,'categories',false,'es'); ?><br />
      </p>
    <?php }
  }
  ?>
March 8, 2019 at 9:08 am #3290370

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

Can you tell me if something like this would work for you?
https://wpml.org/forums/topic/how-to-filter-get_terms-function-my-own-language/#post-1279179
https://wpml.org/forums/topic/display-all-terms-from-all-languages/#post-150191
https://wpml.org/forums/topic/get-translated-taxonomy-names-via-wp_get_post_terms/#post-529788

Regards,
Bruno Kos

The topic ‘[Closed] Get taxonomy term name of translation’ is closed to new replies.