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>

1 Answer 1


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.

  • Perfect, thanks worked it out in the end using this solution also updated so query wasn't using showposts
    – Vince P
    Aug 1, 2013 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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