Ok, so i have a Custom Post Type called "Services". This custom post type has a taxonomy called "Areas" and there's 5 terms in that taxonomy.

Let's say I have 10 posts on "Services" and there's 5 posts in the term "Painting" and 5 more on the term "Photography".

I need to be able to query posts from "Services" but instead of showing those 10 posts, only show 5 associated to "Painting".

At the moment i'm able to query by taxonomy and terms, but that will show all of the posts from "services" with no filter by term.

Basically query post by post_type from the term I choose.

Any help would be awesome. Thanks.

<ul id="service-list">
        $args = array('tax_query' => array( array('taxonomy' => 'areas', 'field' => 'slug','terms' => 'painting')));

        $the_query = new WP_Query( $args );

        if($the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();


    <li class="service">
        <h2><?php the_title(); ?></h2>
        <?php the_content(); ?>
    </li><!-- /.service -->

<?php endwhile; else: ?>

    <p>Nothing Here.</p>

<?php endif; wp_reset_postdata(); ?>

</ul><!-- #service-list -->

So if I could just specify on the $args from which post type to get the posts from this would be solved.

  • Ok, so it looks like I over thought all of this and the solution was really simple:
    – Rise
    Commented Mar 14, 2012 at 17:55
  • Please mark your answer as correct or delete the topic.
    – AlxVallejo
    Commented Mar 14, 2012 at 17:57
  • I need to wait 7 hours to post the solution :(
    – Rise
    Commented Mar 14, 2012 at 17:58

1 Answer 1


This is the answer to the question :)


$args = array(
    'post_type'=> 'services',
    'areas'    => 'painting',
    'order'    => 'ASC'

$the_query = new WP_Query( $args );
if($the_query->have_posts() ) : 
    while ( $the_query->have_posts() ) : 
       // content goes here


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