Taxonomy filter with checkbox custom field
-
I have taxonomy template set up that shows only related custom posts based on their tag. I would like to further refine these results by hiding some of the posts. I have created a “hidden” meta checkbox and I’d like to add a line to my query in that template to hide any posts that have the box checked.
Here is what I tried, but I can’t seem to get any variation of it to work…
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); global $wp_query; query_posts( array( "$term->taxonomy" => "$term->slug", 'orderby' => 'title', 'order' => 'ASC', 'meta_key'=>'gcw_hide', 'meta_value'=> 0, 'showposts' => 100 ) );
As soon as I add this line:
‘meta_value’=> 0,
I get zero results. Based on my test data, I should have a different set of results for the checked and unchecked posts. Any clues?
- The topic ‘Taxonomy filter with checkbox custom field’ is closed to new replies.