wp_schedule_event will it run if timestamp has passed?

I’ve been told by my clients that scheduled jobs are not run some times as expected. I never questioned myself about how wp_cron actually works, I thought it was kinda self-explanatory. But now I doubt it.

Codex says that timestamp argument is:

the first time that you want the event to occur. This must be in a UNIX timestamp format.

I know that wp_cron triggers events when someone visits the site. But what if the visit happens little bit after the time hardcoded in timestamp? Will that event still trigger? Or pass?

2 Answers
2

Yes, the event will trigger when the wp-cron process gets run. If something is preventing wp-cron from running, then it won’t trigger at all. If you’re having it not work, then something about your server configuration is preventing it from working.

For these cases, you can generally work around them by adding this define to your wp-config file:

define('ALTERNATE_WP_CRON', true);

Leave a Comment