Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Past Events in Search Results › Reply To: Past Events in Search Results
April 27, 2023 at 5:49 pm
#42336
Keymaster
Thank you very much, that is actually very helpful.
Based on their documentation, I believe using a small custom code snippet is the best option here:
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' => 'evcal_srow',
'value' => time(),
'operator' => '>=',
'allow_missing' => false
);
return $args;
}
Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines. If you need help, then let me know.
If their documentation is correct, then this code should filter out every event which started before the current date, and olny show the ones that does not started yet.