A
A
Anton Dymov2020-01-09 01:38:48
Taxonomy
Anton Dymov, 2020-01-09 01:38:48

How to display terms from custom taxonomy in Wordpress?

What to change in the code so that the displayed tag names (tags) belong to a specific post. Now the entire content of the taxonomy is glued to each post announcement.

<?php $terms = get_terms( ['taxonomy' => 'first' , 'hide_empty' => false'] );  if($terms) { foreach ($terms as $term){
    echo "<span>{$term->name}</span>";}}
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pychev Anatoly, 2020-01-09
@hiccosik

Carefully read the documentation for the "get_terms" function you are using.
It has an argument that is responsible for the attached posts for which tags will be displayed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question