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?


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);
| improve this answer | |
  • 3
    What does ALTERNATE_WP_CRON do? – jayarjo Feb 3 '11 at 7:51
  • 2
    It changes the way that WP starts the wp-cron.php process. I wrote an extremely detailed answer here about a year ago: wordpress.org/support/topic/… – Otto Feb 3 '11 at 7:53

Yes, event is triggered as soon as possible after scheduled time has passed.

| improve this answer | |
  • Have you ever encountered a case of it not triggering? – jayarjo Feb 3 '11 at 7:31
  • @jayarjo if that is happening inconsistently I think it's more likely that something fails or timeouts in hooked tasks, rather than cron task itself. Hard to say without hands-on debugging. – Rarst Feb 3 '11 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.