Support

Account

Home Forums General Issues Checkbox filter – multiple queries Reply To: Checkbox filter – multiple queries

  • Not sure how this is effecting your code, but your missing a closing } on your one of your loops

    
    foreach( $GLOBALS['my_query_filters'] as $key => $name ) {
        
        // continue if not found in url
        if( empty($_GET[ $name ]) ) {
          
          continue;
          
        }
        
     
       $values = explode(',', $_GET[ $name ]);
    
      // I think there should be a } here before foreach( $values as $value ){
    
      }
    
      // I also think that you should be testing to see if there are any values
    
      if ($values) {
       
    
       $meta_query['relation'] = 'AND';
       foreach( $values as $value ){
        // append meta query
    
          $meta_query[] = array(
                'key'   => $name,
                'value'   => '"' . $value . '"',
                'compare' => 'LIKE',
                
            );
        }
      }
    

    Not sure if any of this will help or not