Querying posts by taxonomy
-
I have a custom taxonomy set up for regular posts, called Miscellaneous. I want to use that in WP_Query to get all posts that have Banner as one of the values of that taxonomy. I have this code:
$args = array( 'Miscellaneous'=>'Banner', 'post_type'=>'post', 'posts_per_page'=>'10' ); $banners = null; $banners = new WP_Query($args); while($banners->have_posts()) : $banners->the_post();?>
I’m getting all posts though. I did a print_r on $banners and the sql going to mysql it this:
SELECT SQL_CALC_FOUND_ROWS fh_posts.* FROM fh_posts WHERE 1=1 AND fh_posts.post_type = 'post' AND (fh_posts.post_status = 'publish') ORDER BY fh_posts.post_date DESC LIMIT 0, 10
I don’t see anything about my taxonomy in there at all. Is it possible to filter by taxonomy at all?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Querying posts by taxonomy’ is closed to new replies.