There are multiple reports on how wp-cron is a far from ideal solution because it runs every time a page is loaded, which is unnecessary in most scenarios (one scenario in which it would be necessary is when you use scheduled posts)

The common advice is to add define('DISABLE_WP_CRON', true); to wp-config.php then schedule a real cron job (if you have enough admin access to so).

But as of WP 3.3, there is WP_CRON_LOCK_TIMEOUT, which "defines a period of time in which only one cronjob will be fired".

If you run hundreds of WP installs you would have to create (and delete, when that wp install is removed) a LOT of cron jobs, which can become a nuisance. Therefore, it seems that the best solution these days is setting define('WP_CRON_LOCK_TIMEOUT', 900); (if you want wp-cron to run every 900 seconds).

The question is: has anyone used WP_CRON_LOCK_TIMEOUT with this purpose yet? Is this its intended use?

1 Answer 1


This is the intended use of the WP_CRON_LOCK_TIMEOUT constant.

When WordPress is loaded, it checks to see if a cron job is running (if cron is locked). If cron is not locked, it will try to create a lock - if the lock timeout has not been reached, no lock can be acquired and cron is not run.

If no cron job is running, and the timeout has passed (meaning a lock can be created), then cron is run.

  • thanks! and define('WP_CRON_LOCK_TIMEOUT', 900); is the correct syntax?
    – Gaia
    May 20, 2013 at 18:44
  • 1
    Yes. Place that definition in wp-config.php and keep in mind it's in seconds.
    – EAMann
    May 20, 2013 at 20:56
  • Didn't work. One site (3.5.1, on the same same as all other sites) which has the Newsletter plugin (wordpress.org/plugins/newsletter) was able to fire up wp-cron.php 9 times in the last hour (while WP_CRON_LOCK_TIMEOUT = 900)
    – Gaia
    May 21, 2013 at 0:20
  • It surely isn't working... I'm still occasionally (now on other sites than the one above)getting more than 1 hit to wp-cron from localhost within 900 seconds (each with a different ?doing_wp_cron=XXXXXXXXX)
    – Gaia
    May 21, 2013 at 11:43
  • 2
    Be careful how you qualify "fire up wp-cron.php." Just because the file is called doesn't mean cron is running. The check to see whether or not cron jobs should run is inside wp-cron.php. Making a request to that file will check the timeout, then either proceed or exit.
    – EAMann
    May 21, 2013 at 15:45

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.