This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Understanding wp_schedule_event
Post Body

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 <?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.

Author
Account Strength
80%
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
333
Link Karma
202
Comment Karma
131
Profile updated: 4 days ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago