$args = array(
'post_type' => 'shows',
'operator' => 'AND',
'tax_query' => array(
array(
'taxonomy' => 'location',
'field' => 'slug',
'term' => 'california',
),
array(
'taxonomy' => 'genre',
'field' => 'slug',
'term' => 'comedy',
)
)
);
$my_query = new WP_Query();
$my_query->query($args);
while ( $my_query->have_posts() ) : $my_query->the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
wp_reset_postdata();
my taxonomy:
register_taxonomy('location',array (
0 => 'shows',
),array( 'hierarchical' => true, 'label' => 'location','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => 'location'),'singular_label' => 'location') );
register_taxonomy('genre',array (
0 => 'shows',
),array( 'hierarchical' => true, 'label' => 'genre','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => 'genre'),'singular_label' => 'genre') );
my objective is to display the posts with terms ex. california and comedy, i tried to do the relation but unfortunately no results are displayed