WordPress Has a Number of Scheduled Tasks Which are Overdue
“WordPress has a number of scheduled tasks which are overdue” is a warning you may see from the Updraft Plus plugin.
It’s not an issue with Updraft itself, but it’s reporting an issue with your WordPress site in general. More specifically, it’s letting you know that the WordPress system that handles scheduled tasks, WP Cron, is not running as expected. However, this issue may prevent Updraft’s scheduled backups from running on time.
What is WP Cron?
WordPress itself, along with many plugins, may need to run certain tasks on a schedule. Here are some examples of scheduled tasks:
- Updraft runs backups according to the schedule you choose.
- WordPress itself may need to publish a post in the future, if you have used the schedule feature.
- You may have a plugin that cleans your database every day, that will also rely on scheduled tasks.
In order to run these tasks on schedule, WordPress uses the WP Cron system.
Every time a page is loaded on your site, WordPress calls wp-cron.php
. This file checks to see if there are any scheduled tasks that need to run, and if so, they are triggered.
If this file isn’t called, tasks won’t run.
But, for this to work reliably, there needs to be activity on your site – either visitors to the frontend of your site (on uncached pages), or activity in the backend of your site.
Without any activity, wp-cron.php
won’t be called and therefore scheduled tasks won’t get triggered at the expected time.
When this happens, it will trigger the warning from Updraft.
How to resolve the warning
To resolve this you will need to:
- Disable WordPress’ own trigger to hit
wp-cron.php
- Instead call the file directly with a cron job set up on your server, through your host.
To take care of the first step, add the following to your wp-config.php
file:
define('DISABLE_WP_CRON', true);
Code language: JavaScript (javascript)
For the second step, ask your host to set up a cron job on the server to hit wp-cron.php
every 5 minutes. This will be more reliable since it will not rely on traffic or activity on your site to trigger wp-cron.php
That doesn’t necessarily mean tasks will run every 5 minutes, but it will check to see if there is anything that needs to run.
If you only ping the file at a long interval, tasks can stack up and then create a backlog.
The exact method for setting up a cron on your host may vary, so you should consult your host’s support or knowledgebase.
Here are links for some common hosts:
Alternatively, you can also use an external cron service such as EasyCron.com
Alternate WP Cron
Some articles referencing this error recommend using alternate WP Cron instead:
define('ALTERNATE_WP_CRON', true);
Code language: JavaScript (javascript)
But this still relies on site activity so it’s not necessarily going to work for you.
Setting up a server cron as described above is the most reliable and therefore the recommended method.
See the scheduled tasks on your site
If you want some insight into the scheduled tasks on your site site, there are a number of plugins available for that, like WP Crontrol or Advanced Cron Manager.
With these plugins you can see how often tasks are scheduled (1), when they should run (2), and you can remove them, run them manually (3) and more.
As a bonus side effect of disabling WP-Cron and using a server-side cron, your site will perform better especially as your traffic increases.