On a taxonomy archive, how does one create multiple loops for different post types that share that taxonomy? I'm using taxonomy-themes.php so that it applies to all three of the terms in the 'themes' taxonomy (climate change, governance, peace building).

On each term's archive page, I want to output the main taxonomy loop (posts), and then I want to create loops for each of 'events', 'resources' and 'staff' (all of which are custom post types). I'm assuming that I create new wp_query for each of the post types, but how do I tell that query which term I want it to get 'events' from (ie. the current archives' term)?

1 Answer 1


As you point out, if you want separate loops for different post types you'll need to use a separate WP_Query() for post type. In the template you can get the current term (ID) being viewed via: get_queried_object_id() (see source)

$args = array( 
          'post_type' => 'staff',
          'tax_query' => array( 
              'taxonomy' => 'themes',      
              'terms' => get_queried_object_id(),
              'field' => 'id'
$staff = WP_Query( $args );
  • Thanks very much Stephen. That did it perfectly. And wow is queryposts.com helpful. Jun 6, 2013 at 11:45

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.