4

I am using a plugin to send emails to a relatively large email list. Because we have a low per-hour email threshold from our host we have to use a setting in the plugin to throttle the emails down to only a certain number every hour. I am assuming that the plugin uses wp-cron to accomplish this. I have tried finding documentation on wp-cron but the only substantial information I have been able to find is that it requires a page view to run.

Questions:

  1. Is an RSS feed being pinged enough to trigger a "page view" and therefore wp-cron?
  2. How long after a page view will wp-cron run? (e.g. if last page view is at 6:59p.m. will cron scheduled for 7pm run?)
  3. What happens if a cron job is missed?(No one visits website all day until 7:03 p.m. Is 7p.m. cron job run?)
2

1 Answer 1

4
  1. Yes.

  2. No, because the scheduled job hasn't reached the time yet.

  3. Yes, but not until 7:03pm.

Basically, any hit to the site after the scheduled time will cause the queued job to run. The WP_Cron is a "best effort" system, not an exact timer. This is generally good enough though, since if nobody's visiting the site, then it doesn't need to run and do anything for the most part.

6
  • Thanks for clarifying #3. +1 Question: Will all jobs run, when the time was missed, or just the last one?
    – kaiser
    Commented Aug 30, 2012 at 17:03
  • 1
    All jobs run, but not necessarily at once. PHP on websites typically has a 30 second timeout, if the total job queue takes longer than that, it may get deferred to the next hit.
    – Otto
    Commented Aug 30, 2012 at 17:55
  • @Otto So if I have stuff running in the wp-cron I can be assured that it will run eventually?
    – fdsa
    Commented Sep 1, 2012 at 2:13
  • No, because nobody might visit your site. :) It will probably run. That's the best anybody can say. If you need guarantees, use a real cron job instead.
    – Otto
    Commented Sep 1, 2012 at 4:22
  • Hi Otto, i have a doubt. Why not use init hook so every time user visits we'll check the time and do whatever we want instead of cron as cron too works on page visits. What is the advantage in cron then other regular hook which gets executed on page visits like wp_head. @Otto
    – sun
    Commented Apr 26, 2014 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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