K
K
kapost2020-02-22 03:22:40
Taxonomy
kapost, 2020-02-22 03:22:40

How to display a link to a custom category of the current post in WordPress?

Created custom taxonomy - Sports. Relatively speaking, if the publication is about football, then in the publication itself you need to display a link to the "Football" section. And so on for other types. By and large, the principle is the same as with a link to the category of the current post, but it doesn’t work with taxonomy. I revised the code on this topic, but it turned out only to display the title of the rubric, and not the link. Or, if with the php function the_taxonomies( $post_id, $taxonomy, $args ); then we get the entire list that belongs to the publication: category, tags and sports. All you need is a link to a specific category.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kapost, 2020-02-22
@kapost

solution found <?php echo get_the_term_list( $post->ID, 'taxonomy', '', ', ' ); ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question