Support

Account

Home Forums General Issues Query posts where relationship field value is inside an array Reply To: Query posts where relationship field value is inside an array

  • 
    if (isset($_POST['region'])) {
      $regions_arr = $_POST['region'];
      $meta_query = array('relation' => 'OR');
      foreach ($regions_arr as $id) {
        $meta_query[] = array(
          'key' => 'product-region',
          'value' => '"'.$id.'"',
          'compare' => 'LIKE'
        );
      }
      $args['meta_query'] = $meta_query;
    }