Combine All and Any mode in Gravity form

16 Views Asked by At

i have this sample code to filter entries using both OR and AND conditions, but it always return all entries. Any suggestions?

$search_criteria = array(
'status'        => 'active',
'field_filters' => array(
    'mode' => 'all', 
    array(
        'key'   => '1',
        'value' => '1'
    ),
    array(
        'key'      => '2',
        'value'    => '0',
        'operator' => '>='
    ),
    array(
        'field_filters' => array(
            'mode' => 'any', 
            array(
                'key'   => '3',
                'value' => '8'
            ),
            array(
                'key'   => '4',
                'value' => '6'
            )
        )
    )
)

);

1

There are 1 best solutions below

0
Rochelle On

You will want to use GF_Query to do complex conditions. This was asnswered here: Combined ANY/ALL (AND/OR) in GravityForms GFAPI::get_entries?