How can I remove links from the function “get term list”?

<?php echo get_the_term_list( $post->ID, 'people', 'People: ', ' ', '' ); ?> 

returns something like this:

People: <a href="https://wordpress.stackexchange.com/questions/12746/person1">Person1</a>, <a href="person2">Person2</a>, ...

How can I make it return the same thing without links like this:

People: Person1, Person2

4 Answers
4

It may be easier to just write the list manually, something like:

<?php
$terms = wp_get_post_tags( $post->ID );
//For custom taxonomy use this line below
//$terms = wp_get_object_terms( $post->ID, 'people' );

foreach( $terms as $term )
    $term_names[] = $term->name;

echo implode( ', ', $term_names );

Leave a Comment