I need to display the current term in my custom taxonomy in a single post.

example:

  • My custom taxonomy is products and term of them is product-1, product-2 and products-3.
  • My post is assigned to product-2
  • And I want to print the current products = products-2 in my post

In fact, I need a function like WordPress’s the_category(); but for my taxonomy like the_customtaxonomy();

UPDATE :

in facts i know i need to get id of this becuse i need to show a icon for this in my single , for example a function like the_category_ID();

7 s
7

You can use get_the_term_list():

Description

Returns an HTML string of taxonomy terms associated with a post and given taxonomy. Terms are linked to their respective term listing pages.

Usage

<?php get_the_term_list( $id, $taxonomy, $before, $sep, $after ) ?>

Leave a Reply

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