Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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);
share|improve this answer
2  
What does ALTERNATE_WP_CRON do? –  jayarjo Feb 3 '11 at 7:51
1  
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
    
Thanks for the link. –  jayarjo Feb 5 '11 at 6:23
add comment

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

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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