So I ran into an issue on a website this morning that uses WP Cron. The code looks like this:
//Schedule the cron to run if not scheduled
if ( ! wp_next_scheduled( 'my_check_cron_event' ) ) {
wp_schedule_event( strtotime('tomorrow America/New_York') , 'daily', 'my_check_cron_event' );
}
The issue is pretty simple. That code works fine, essentially I want to run the function at midnight local time, every day. So when I first run the function - it gets the timestamp for midnight tomorrow - local time. And ever since - the functino has been running.
Now this weekend - because of daylight savings time, the function doesn't actually ever get RESCHEDULED - its just set to run every 24 hours. So the function started running at 11pm. Of course that's easy to fix - but will just break again. I can't really find any good posts on the topic - how would you deal with:
wp_schedule_event running daily when daylight savings time changes?
Just to preempt an obvious answers here: I can't run a proper cron - it needs to be done through wp. Our host simply doesn't support it, it sucks - but that's the client. Any advice would be greatly appreciated!