I need to query all posts from a custom post that doesn’t have ‘kit’ applied to the taxonomy ‘image-gallery’.
I am using the following code but it returns no results:
<?php $query = array( 'post_type' => 'image-gallery', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'image-gallery', 'field' => 'slug', 'terms' => 'kit', 'operator' => 'NOT IN' ) ) ) ?>
Can anyone see what might be wrong with it?
- The topic ‘Excluding posts from a custom taxonomy’ is closed to new replies.