WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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).

share|improve this answer
Simple and easy to use. thanks a lot ;) – Sagive SEO Mar 26 '12 at 0:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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