3

I'm working on a particularly large WordPress multisite network, and have been struggling with WP-Cron. It seems that WP-Cron tasks are being scheduled, but not run.

The WP-Cron tasks are not being run on either our staging or production environments, but locally, they run fine. The instances are all identical—multisite, with the same set of sites, the same theme, and the same plugins activated (and same versions of plugins). There are slight differences in the version of PHP on the server and in my local sandbox, but the WP versions are the same (a little behind the current – 3.5.2)

I've tried clearing the queue, and hitting the cron script directly (/wp-cron.php?doing_wp_cron), but without success. I even tried scheduling a call to that script in an actual cronjob, but with the same result—nothing.

I double-checked that DISABLE_WP_CRON is not present in the wp-config file, and even played with defining that constant to false.

Any insight into why it might not be running, or how to force it to run, would be very helpful.

  • Do you have access to the server logs on your staging and production boxes? See if there are any errors in there related to wp_cron.php. – Pat J Dec 24 '13 at 2:09
  • If you're using a direct call to the script via cron and it's not working, then my guess is it's not a wordpress issue, so I'd start by checking the script itself and it's file permissions. – TomC Dec 24 '13 at 8:43
  • A late comment: what about the timezones set on your two different environments (test and production)? In case, you could give a try to the PHP function date_default_timezone_set("Europe/Rome"); (of course, set your own locale) – Erenor Paz Feb 9 '17 at 11:31
0

First can you please confirm that you don't have any caching plugins enabled? Caching plugins can interfere with cron jobs because your visitors are not served a live page but a cached version of your page.

If you have a caching plugin enabled, you can choose one of your pages, add an exclusion to your caching plugin's settings for that page so that it is never cached.

Then you'll have to manually create a cron job (using Cpanel if you're on a shared hosting environment or from the terminal if it's a VPS/dedicated server) that will visit that page every few minutes.

I hope that helps!

Refe:WP Cron Doesn't Execute When Time Elapses

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.