Most of the time, the WordPress Cron works quietly and tirelessly in the background of your website, keeping a few things ticking over without you really noticing. Sometimes though, the WP Cron can stop working. This can be for a multitude of reasons but it can often be tricky to pin down. This article aims to clarify the function of the WP Cron and how to troubleshoot it, if it ever stops working.
What is a Cron?
Also known as a ‘cron job’, a cron is a time-based job scheduler. Think of it as a clock and calendar but for the inner workings of a server: it knows when something needs to happen and when.
What is the WP Cron?
The WP Cron is essentially a virtual cron that WordPress uses to run jobs at a certain time. It’s not a proper cron like the one mentioned above though. As such, it does have some caveats. These mostly happen when your WordPress website loses track of time or cannot keep to a regular schedule for some reason.
How do I know my WP Cron is broken?
Common things that you may notice when the WP Cron isn’t working are:
- Scheduled posts don’t publish at the correct time or at all.
- Backup plugins don’t run their scheduled backup.
- Mailing list plugins don’t send emails on time.
- You see URLs in your website analytics with ?doing_wp_cron at the end, followed by some numbers.
- Automatic updates for plugins, themes, or WordPress core aren’t installed when they’re released.
When it comes to Better Notifications for WP and the WP Cron, other issues may occur, such as:
- ‘New Post Published’ notifications aren’t sent on time when a scheduled post moves from scheduled to publish status.
- Update Reminder notifications aren’t sent after the set period of time.
- User Login Reminder notifications aren’t sent after the set period of time.
- Digest notifications aren’t sent on time or at all.
Why does the WP Cron stop working?
WP Cron only runs on a schedule when some ‘thing’ visits your site, either to the front-end or the WordPress admin. I say some ‘thing’ because to WordPress, it doesn’t matter if it’s a user, a visitor, or a bot – it just has to visit your site in a way that will keep the WP Cron running on time.
This is fine for high-traffic websites (in fact it can also be a problem) but for sites that don’t get visited that often, or sites that are behind a login or used on an internal network, it can mean that the WP Cron doesn’t run correctly.
My WP Cron is broken! How can I fix it?
Fortunately, there are a number of steps you can take to re-start the WP Cron and get it working more consistently moving forward. The suggestions below are written in order from easier at the top, to hardest at the bottom.
Use an uptime monitor to ‘ping’ your site every X minutes/hours/days
Services that provide uptime monitoring, such as StatusCake, UptimeRobot, and Pingdom are a great solution for this. This is the recommended first step by many large WordPress companies, including WooCommerce.
Check your WP Cron is not disabled
If you see
define( 'DISABLE_WP_CRON', true ); in your wp-config.php file. Try removing it to see if it helps.
Check your wp-cron.php file actually exists!
It should be in the root folder for your website on your server. It should also have the correct file permissions – specifically ‘644’.
Disable the WP Cron and set up a proper cron
SiteGround has a good article on how to disable the built-in WP Cron and set a proper cron to run in your hosting control panel (if available). You can use the excellent WP Crontrol plugin to find out which cron jobs are running and when so that you can accurately replicate them if you were to do this.
Use a 3rd party cron service
Using a 3rd party cron service, such as SetCronJob or EasyCron, will allow you to trigger any cron jobs remotely, thereby keeping the WP Cron to a schedule.
My WP Cron is still broken!
If you’re still having trouble, it’s possible that your host has disabled WP Cron or prevented it from running properly. This can be the case in some managed WordPress hosting environments. If this is the case, they may have replaced it with a proper cron running on the server instead (as mentioned above). Either way, you’ll most likely need to get in touch with them in order to troubleshoot further.