Strip tags from a the terms() function

Harper: 2 weeks ago

Trying to print my custom post type's taxonomy but without the link. Tried this, but doesn't seem to work, any suggestions?

$text = the_terms($post->ID,'type','','',''); 
echo strip_tags($text);

Any help would be greatly appreciated... I'm about to start punching babies.

Gabriella: 2 weeks ago

You could use a filter and strip_tags(), as you suggested. Example using post tags, since that's the taxonomy I had available:

function my_remove_links( $term_links ) { 
    return array_map('strip_tags', $term_links);
add_filter('term_links-post_tag', 'my_remove_links');

Really though, I would just get_the_terms() ( and and craft the output yourself:

function the_simple_terms() {
    global $post;
    $terms = get_the_terms($post->ID,'post_tag','',', ','');
    $terms = array_map('_simple_cb', $terms);
    return implode(', ', $terms);

function _simple_cb($t) {
    return $t->name;

echo the_simple_terms();