WordPress tax_query “and” operator not functioning as desired

not tested but give this a shot

'tax_query' => array(
   'relation' => 'AND',
    array(
      'taxonomy' => 'image_tag',
      'field'    => 'term_id',
      'terms'    => 25,
      'operator' => 'IN',
    ),
    array(
      'taxonomy' => 'image_tag',
      'field'    => 'term_id',
      'terms'    => 41,
      'operator' => 'IN',
    )
  ),

OR

'tax_query' => array(
   'relation' => 'AND',
    array(
      'taxonomy' => 'image_tag',
      'field'    => 'term_id',
      'terms'    => array(25,41),
      'operator' => 'IN',
    ),
  ),

Leave a Comment