Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Custom field filters – selectors : Night Duration › Reply To: Custom field filters – selectors : Night Duration
April 21, 2021 at 12:08 pm
#32866
Keymaster
That way is not possible, but you can try custom coding to map values and change the operator via the asp_query_args hook:
add_filter("asp_query_args", "asp_query_args_change", 10, 2);
function asp_query_args_change($args, $search_id) {
foreach( $args['post_meta_filter'] as &$filter ) {
if ($filter['key'] == 'nights_duration') {
if ( strpos($filter['value'], '--') !== false ) {
$filter['value'] = explode('--', $filter['value']);
$filter['operator'] = "BETWEEN";
}
}
}
return $args;
}
..then use the range values like:
1--3||1-3 Nights
4--6||4-6 Nights
etc..