Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 1 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

 
discard

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.