0

If I have a function set to run every 5 minutes via a WP cron job, and I have only one visitor during a day, does his visit trigger just one run of that function or all the runs that have been amassed since the last visit?

The cron job I have runs a function that fetches feeds from another site.

4
  • You'll need to add more detail for us to assist you. What does the WP cron job do?
    – Pat J
    Dec 10, 2013 at 16:18
  • Not trying to self-promote my answer, but there was a question asked here a while back: "WP Cron doesn't execute when time elapses" - Asked by: @Mike Madern. There is a lot of useful information in my answer to his question. Dec 10, 2013 at 17:23
  • @MichaelEcklund Good information about cron there but it doesn't clearly answer my question about whether the function runs pile up or whether the function is run just once.
    – urok93
    Dec 10, 2013 at 17:46
  • 1
    If the cron is setup properly, and it doesn't run when it's supposed to... It will just run ONE time, whenever the next visitor lands on your website. In my answer (Link located in my first comment.), I mentioned setting up a legitimate cron job via your web hosting provider to visit your WordPress website at the desired intervals. That will guarantee your cron job fires exactly when you need it to. Setup your cron job via WordPress like you normally would, then just create a REAL cron job on your web server to visit your WordPress website at the desired interval. Dec 10, 2013 at 17:54

1 Answer 1

0

The wp_schedule_single_event function in cron.php (http://core.trac.wordpress.org/browser/tags/3.7.1/src/wp-includes/cron.php#L0) has a comment which says:

// don't schedule a duplicate if there's already an identical event due in the next 10 minutes

So I'd say that no it won't trigger lots of calls for earlier in the day.

Your Answer

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

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