• Hi, maybe I am misusing the tax_query parameter set, but here is my code:

    $posts = get_posts( array(
        'post_type' => get_post_type($current_id),
    	'tax_query' => array(
    		array(
    			'taxonomy' => $tax,
    			'terms' => $term_id,
    			'field' => 'id',
    			'operator' => 'IN',
    			'include_children' => true
    		)
    	)
    ) );

    What this is supposed to do is return all posts that belong to term $term_id of the custom taxonomy $tax. Seems simple enough and it does return such posts, except those that also belong to another term within the same taxonomy. It’s maddening and either this is a bug or I am misunderstanding how the API works.

    Can someone please help me keep from pulling the rest of my hair out?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘tax_query not returning posts that multiple terms are applied to’ is closed to new replies.