Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Help with asp_query_args() filter not querying meta_key vale as dates › Reply To: Help with asp_query_args() filter not querying meta_key vale as dates
January 20, 2020 at 9:20 am
#25348
Keymaster
Hi!
That solution looks okay, but there is another way, so no WP_Query is required, saving some performance.
The date filters are indeed not documented, sorry about that. The numeric operators automatically will force the value to a numeric. Can you please try this variation:
add_filter("asp_query_args", "asp_query_args_change", 10, 2);
function asp_query_args_change($args, $search_id) {
// Do your stuff with the $args array
// ....
if($search_id == '1'){
$date = date('Y-m-d');
$args['post_meta_filter'] = array(
array(
'key' => '_EventStartDate',
'value' => $date,
/**
* Operators that should work:
* before, before_inc, after, after_inc, match, nomatch
*/
'operator' => 'after_inc'
)
);
}
return $args;
}