In Order to display an event as Expired after a specific date and time, you need to add the following code to your theme functions.php file.
- Open your child theme,
- Add the code into the funtions.php file.
/* Event Expire by time */
function
my_cron_schedules(
$schedules
){
if
(!isset(
$schedules
[
"5min"
])){
$schedules
[
"5min"
] =
array
(
'interval'
=> 560,
'display'
=> __(
'Once every 5 minutes'
));
}
}
return
$schedules
;
}
add_filter(
'cron_schedules'
,
'my_cron_schedules'
);
function
schedule_my_cron(
$args
){
wp_schedule_event(time(),
'5min'
,
'my_schedule_hook'
);
}