I have a custom post type "restaurants" and a taxonomy "location", so I can get the restaurants for one location by URL. On the taxonomy page for one specific location (CityA) I want to display all post types from restaurants and the taxonomy term "CityA". However, Wordpress also gives me posts with taxonomy terms "CityB" or "CityC" in the very same query. Have a look:
$args = array ( 'post_type' => 'restaurants', 'tax_query' => array ( 'taxonomy' => 'location', 'field' => 'slug', 'terms' => 'citya' ), 'order_by' => 'title', 'order' => 'ASC' );
$query = new WP_Query ( $args );
while ( $query -> have_posts () ) {
$query -> the_post();
echo get_permalink($post->ID;
}
This gives me ALL posts of post_type "restaurants". And yes, the slug for CityA is definetely "citya", I double checked all arguments.