Почему не работает фильтр через meta_query ACF?

  global $post;
  if($_POST['marks']){
    $marks = $_POST['marks'];
  }else{
     $args_marks = [
    'taxonomy' => 'car_mark',
    'hide_empty' => false,
  ];

  $marks_term = get_terms( $args_marks );
  $marks = [];
  foreach($marks_term as $term){
    $marks[] = $term->slug;
    }
  }

   // status
   // Array
   // (
   // [0] => instock
   //  [1] => reserved
   // )
   $status = $_POST['status'] ? $_POST['status'] : '';
   $meta_q_status = [];

   $paged = $_POST['paged'] ? $_POST['paged'] : 1;
   $post_type = 'car';
   $taxonomy_mark = 'car_mark';

   if(!empty($status)){
     foreach($status as $status_q){
        $meta_q_status[] = [
            'key'     => 'position_car',
            'value'   => $status_q,
            'compare' => 'LIKE',
       ];
     }
   }

    // body type
    // Array
    //(
    //    [0] => hatchback
    //    [1] => universal
    //    [2] => kupe
    //)

  $body_type = $_POST['body_type'] ? $_POST['body_type'] : '';
  $meta_q_body_type = [];
  if(!empty($body_type)){
    foreach($body_type as $body_type_q){
      $meta_q_body_type[] = [
         'key'     => 'position_car',
         'value'   => $body_type_q,
         'compare' => 'LIKE',
      ];
   }
 }

 $args = [
   'post_type' => $post_type,
   'post_status' => 'publish',
   'tax_query' => [
     [
       'taxonomy' => $taxonomy_mark,
       'field' => 'slug',
       'terms' => array_values($marks),
     ],
   ],
'meta_query' => 
  [
    'relation' => 'AND',
    $meta_q_status,     
                    ],
                    [
    'relation' => 'AND',
    $meta_q_body_type,      
                    ]   
 ];

$cars = new WP_Query($args);

Фильтр не верно работает на данный момент вытягивает каждую машину в которой есть все (например status: instock,reserved ), что приходит из формы а нужно чтобы было извлечено если есть хоть что-то одно (или instock или reserved)


Ответы (0 шт):