Support

Account

Home Forums ACF PRO Filtering posts with multiple select Reply To: Filtering posts with multiple select

  • Hi @galadh

    If the query is like this: &type=typeA,typeB, then you need to add a query for each type listed. It should be something like this:

    if (isset($_GET["type"]) && $_GET["type"]!='') {
        
        // get the listed types in an array
        $types = explode(',', $_GET[ "type" ]);
        
        // initialize the meta query
        $add_args['meta_query']['relation'] = 'OR';
        
        // loop through the types and add it to the query
        foreach( $types as $type ){
            $add_args['meta_query'] []= array(
                'key' => 'tipo_lemma',
                'value' => '"'. $type .'"',
                'compare' => 'LIKE'
            );
        }
    
    }

    I hope this helps 🙂