Hello,
Is there any way to set a shorter time for events to auto-delete after they’ve expired – say, 2 hours, instead of 24 hours?
(Sorry if this is documented somewhere, but I couldn’t find it.)

Shaun Woods
Hi Shaun,
The scheduled event for deleting expired events runs daily:
wp_schedule_event(time()+60, 'daily', 'eventorganiser_delete_expired');
But you can change that to hourly (see https://codex.wordpress.org/Function_Reference/wp_schedule_event) – note, you’ll only want to run that code once. Most examples in the official documentation use wp_next_scheduled() check to if its already scheduled. In your case you’ll probably want to do:
if ( wp_next_scheduled('eventorganiser_delete_expired') > time() + 60) {
wp_schedule_event(time()+10, 'hourly', 'eventorganiser_delete_expired');
}
probably on the init hook would suffice.
Secondly, the eventorganiser_delete_expired hook will trigger a function that deletes events that ended over 24 hours ago. You can adjust that to 2 hours as so:
add_filter( 'eventorganiser_events_expire_time', function() {
return 2 * 60 * 60;
});
In this way, the script runs hourly, and deletes any events older than 2 hours. (Please note, I’ve not tested the wp_schedule_event part.).

Stephen Harris