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 currently have the following code pulling the 10 latest posts from a specific category, I would like to filter those posts to a certain custom taxonomy which I've set up called article type.

What do I need to modify to incorporate this filter?

<div id="btcc" class="main-headline-box">          
<?php $btcc_query = new WP_Query('category_name=btcc&showposts=10'); ?><ul>
<?php while ($btcc_query->have_posts()) : $btcc_query->the_post(); ?>
<li><a href="<?php the_permalink() ?>" title="Permanent Link to: 
<?php the_title_attribute(); ?>">
<?php the_title(); ?></a></li>
<?php endwhile; ?><li class="read-more"><a href="">Read more from the BTCC Archive</a></li></ul>
share|improve this question
up vote 1 down vote accepted

A simple search in codex shows how to do that :

$args = array(
'post_type' => 'post',
'tax_query' => array(
        'taxonomy' => 'people',
        'field' => 'slug',
        'terms' => 'bob'
$query = new WP_Query( $args );

EDIT: do not use showposts, it's deprecated.

share|improve this answer
Perfect, thanks worked it out in the end using this solution also updated so query wasn't using showposts – Vince Pettit Aug 1 '13 at 13:23

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.