Filter/multi-taxonomy query
-
Hello!
I have some Custom Post Types with custom taxonomies. I’m trying to build a query for two of the taxonomies… to filter Location (tax) results by Job Title (tax). I am at a loss why I can’t get the basic query to even begin. Do you see what’s wrong??
Thanks in advance!
<?php $args = array( 'relation' => 'AND', array( 'taxonomy' => 'location', 'field' => 'slug', 'terms' => 'Denver', ), array( 'taxonomy' => 'job_title', 'field' => 'slug', 'terms' => 'photographer', ), ); echo "line after args declaration....<br>"; // Custom query. $query = new WP_Query( $args ); echo "line after query declaration....<br>"; // Check that we have query results. if ( $query-> have_posts() ) { // Start looping over the query results. while ( $query->have_posts() ) { $query->the_post(); echo "Success <br>"; } } else { echo "FAIL <br>"; }; echo "End of line"; // Restore original post data. wp_reset_postdata(); ?>
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Filter/multi-taxonomy query’ is closed to new replies.