WP-Cron tasks scheduled but not running

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.

1 Answer
1

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

Leave a Comment