Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Can't put events in date order in search results › Reply To: Can't put events in date order in search results
December 1, 2022 at 1:22 pm
#40332
Keymaster
Hi,
The date picker format is usually only for visual purposes only, the actual values are probably stored in the “Y-m-d” format, that is very common. It is more likely a data type issue only.
I have made a correction via the theme file editor, as the code was already there and added extra quote signs to cast the date to a string. Can you check if this changed anything in the results?
For reference, the new code is:
add_filter("asp_query_args", "asp_query_args_apply_date", 10, 2);
function asp_query_args_apply_date($args, $search_id) {
$args['post_meta_filter'][] = array(
'key' => 'mec_end_date',
'value' => "'" . date("Y-m-d") . "'",
'operator' => '>',
'allow_missing' => false
);
return $args;
}