I have a function that I've been attempting to get to work with wp_schedule_event. The function sends a notification to the admin. I see the event get added to the wp cron event list, but it never runs the function.
Function as follows:
<?php
function send_booking_expiration_notification(){
// do woocomerce booking stuff... then send email.
wp_mail($to, $subject, $message, $headers);
}
// Schedule the send_booking_expiration_notification() function to run daily at midnight
if ( ! wp_next_scheduled( 'send_booking_expiration_hook' ) ) {
wp_schedule_event( strtotime( '12pm' ), 'hourly', 'send_booking_expiration_hook' );
}
add_action( 'send_booking_expiration_hook', 'send_booking_expiration_notification' );
?>
Am I misunderstanding scope or hooks. I've added the add_action above the function and still no dice. I can call the function and the have confirmed the function works and send email, but something with the cron isn't working.