tax_query filters more than it should
-
Hi, I stumbled upon a really weird bug(?). I have follwowing query:
$myQuery = new WP_Query(array( 'post_type' => 'custom_type', 'posts_per_page' => -1, 'tax_query' => array(array( 'taxonomy' => 'custom_taxonomy', 'field' => 'id', 'terms' => array(282), 'operator' => 'NOT IN' )) ));
What I am expecting is to get only posts that don’t have the custom_taxonomy term with the ID 282. But this query also leaves out some posts that don’t have the term with ID 282. So for example a post with following wp_get_post_terms result:
Array ( [0] => stdClass Object ( [term_id] => 32 [name] => Custom term [slug] => custom_term [term_group] => 0 [term_order] => 0 [term_taxonomy_id] => 36 [taxonomy] => custom_taxonomy [description] => [parent] => 0 [count] => 3 [filter] => raw ) )
As you can see, this post has no term with the ID 282. The query doesn’t show none of the 3 posts (see [count] => 3) when I say NOT IN 282.
Did I just miss something in the query? It just doesn’t make sense for me :/
Many thanks for your help!
PS: I had some plugins running but deactivated them for bugfinding purposes, didn’t fix the problem.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘tax_query filters more than it should’ is closed to new replies.