WP Cron is Not Working Correctly. Scheduled Backups Do not Work

WordPress has a system for performing scheduled tasks in the background. This system does many useful tasks, such as cleaning up internals, checking for available updates, and performing actions that plugins are supposed to do at a certain time or on a regular basis like creating perioudic backups of your website.

If you get a message that your WordPress cron job scheduler doesn’t seem to perform any scheduled tasks check out the reasons below:

Does Your Website Have Visitors?

If no one has visited your site for a while, then this situation is to be expected. WordPress only gets the opportunity to do something when visitors access the pages. No visitors mean WordPress is never accessed and WordPress can’t start any scheduled background tasks. So if your site is a staging or development site or has no real visitors for other reason, this message is not surprising. Visit a few pages and the message should go away.

WordPress Maintenance Mode Active?

Is your website in maintenance mode? This disables scheduled tasks of all kinds. So turn the maintenance mode off to activate the WordPress cron jobs.

Is WP Cron Active or Disabled?

The scheduler of WordPress can be disabled in the configuration of your website. WP STAGING will alert you if this is the case and will show you a warning that DISABLE_WP_CRON is true in the wp-config.php of your site.

You can check this manually as well:

Look in the wp-config.php file (located in the root of your WordPress installation) for the line below and remove it. Optionally you can change true to false:

define(‘DISABLE_WP_CRON’, true);

In this case, disabling may be something your web hosting company did on purpose, so be aware that they can disable it again. However, it may also be something you did on purpose and found another way to access the WordPress scheduler system, perhaps through your web hosting company’s control panel.

In this case, the message about DISABLE_WP_CRON is to be expected. Then it is your responsibility to ensure that the scheduler is called frequently enough to process all the jobs scheduled for your site.

No scheduled backups will run until you have set the scheduler system to invoke it.

Also note that DISABLE_WP_CRON can be set in a file other than wp-config.php. wp-config.php is simply the most likely location. If you get a warning about DISABLE_WP_CRON, but it’s not in wp-config.php, then it must be somewhere else. You need to look for it.

Are Loopback Connections Working?

Some web hosting providers intentionally, albeit for no good reason, disable the “loop-back” connections that allow WordPress to run its scheduler. This is also the case if your site is password protected or if you run a staging website that is not open to the public.

If the loopback connections don’t work (whether intentionally disabled or not), you can try out using the WordPress alternative scheduling system.

Add somewhere in the middle of your wp-config.php file a line with the following wording:

define('ALTERNATE_WP_CRON', true);

Don’t add it too late in the file or it will have no effect.

Is Your Entire Website Password Protected?

Another reason for WP Cron and scheduled backups not working could be that your entire website is password protected at the HTTP level. This could be done via an .htaccess file.

This also prevents the scheduler of WordPress from working. You should configure your web server to allow “loop-back” connections to allow connections to itself, otherwise the WordPress scheduler and everything that depends on it will stop working. If you are using Apache and .htaccess, try to add these two lines to the access control section of your .htaccess:

Allow from 0.0.0.0
Satisfy Any

Replace 0.0.0.0 with your website IP address.

Do You Use the Litespeed Webserver?

Have a look at this article if you are using the Litespeed webserver and your wp cronjobs do not work.

Updated on November 14, 2022