Type: string
Possible values: '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'EXISTS', 'NOT EXISTS'

Note: If you are using checkbox or multi-select format with a meta_key field, you must set ‘compare’ => ‘IN’ in order for the search to work. Alternatively, if your meta_key was created using the Advanced Custom Fields plugin you may need to use ‘compare’ => ‘LIKE’.

See the WP_Query documentation for more information.

Using ‘BETWEEN’ to search ranges of values

You may want to use ‘compare’=>’BETWEEN’, to search within a range of meta_key values. This can be achieved using either a single input or two separate inputs. To use two inputs, see the documentation for the inputs parameter.

To use a single input, you can specify the values of your fields as follows:

'values' => array(
            ':10' => '10 and under',
            '11:25' => '11 to 25',
            '26:' => '26 and up'

The syntax accepted is ‘X:Y’, where X is the minimum range value and Y is the maximum range value. Either X or Y may be omitted to create options such as ’26:’ which denotes ‘value 26 or greater’, or ‘:10′ to denote ‘value 10 or less’.

Fields that use this parameter