i have a single-post_type.php file where i constructud a breadcrumb (or similer to)

i am currently using this to get the terms of this taxonomy:

$terms = wp_get_post_terms( $post->ID, 'wedding_cat');

Later on i am showing that term like this:

<div class="breadcrumbs"><?php $term = array_pop($terms);   echo '<a href="'. get_bloginfo('url') .'">'. __('Home', 'sagive') . '</a> &raquo; <a href="index.php?page_id=74">'.__('Wedding Rings', 'sagive').'</a> &raquo; <a href="'.get_term_link($term->slug, 'wedding_cat').'">'.$term->name.'</a>,'?></div>

That way i am only getting one term which is gr8 but..
i need to exclude a specific term comepletly from apearing.

How can i do that?

1 Answer 1


I'd use wp_list_filter() with the operator 'NOT' to compare either the term's name, slug or ID (depending how you want to test for term to be exluded).

Untested but something like this should work (assuming that you want to exclude the term with slug 'myslug'):

 $terms = wp_get_post_terms( $post->ID, 'wedding_cat');
 $terms = wp_list_filter($terms, array('slug'=>'myslug'),'NOT');

(Of course this may mean $terms because empty).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.