Wordpress - Show taxonomic conditions without links - (get_terms, the_terms, wp_tag_cloud)

Is there a way to display taxonomic conditions without referencing them?

Basically, I want to display all terms under my "Headings" taxonomy, but without links.

I tried several solutions like get_terms, get_the_terms, the_terms, wp_tag_cloud, but I could not find a solution.

Thank.

+3
source share
3 answers

The bizarre solution returns all terms if you need to display only those terms that you can use for the message:

$terms = wp_get_post_terms( $post->ID, 'taxonomy-term', array("fields" => "names") );
echo implode(', ',$terms);

Make sure the correct "taxonomic term" is correct!

+2
source

The following code returns all the terms the name of the taxonomy:

    $terms = get_terms( 'cars', array('fields'    => 'names')); 
+1
source
$terms = get_terms("taxonomy");
                 $count = count($terms);
                 if($count > 0)
                     {
                         echo '<ul>';
                         foreach ($terms as $term) 
                             {
                                 echo '<li>'.$term->name.'</li>';
                             }
                         echo '</ul>';
                     }
0
source

Source: https://habr.com/ru/post/1794187/


All Articles