Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How to Query multiple taxonomies in taxonomy template, ex. taxonomy-schools.php Please help, Ihave spend many hours trying to fix this.. Here's my code:

<?php $term =$wp_query->queried_object;

<?php $args = array(
'post_type' => 'schoolname','posts_per_page' => 20,
'tax_query' => array(
          'relation' => 'AND',
   array(
     'taxonomy' => 'schools-location',
     'terms' => $term->term_id,
     'field' => 'id'
   ),
   array(
     'taxonomy' => 'degree-type',
     'terms' => 'dental',
     'field' => 'id'
   ),
)
);


$the_query = new WP_Query( $args );  ?> 

<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>

<?php endwhile;  
wp_reset_postdata(); ?>
share|improve this question
1  
It should work, unless there is a typo in there. But you should have 'field' => 'slug' in second array, I guess. –  Krzysiek Dróżdż Jul 13 '13 at 19:59
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.