Troubleshooting WP Cron
WP Cron is essentially a virtual cron that WordPress uses to run tasks at a certain time or interval. It’s not a proper cron like the one you may get in your hosting control panel and it does have some caveats.
Common issues with WP Cron and BNFW are:
- ‘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.
Why does this happen?
WP Cron only runs when some ‘thing’ visits your site, either on the front-end or the WordPress admin. I say some ‘thing’ because it doesn’t matter if it’s a user, a visitor, a bot, a ping, etc. – it just has to visit your site in a way that will trigger the WP Cron to begin running. This is fine for high-traffic websites (in fact it can also be a problem) but for small scale sites or sites that don’t get visited that often, it can mean that issues such as the ones listed above crop up from time to time.
There are a few ways you can fix this though:
- Use an uptime monitor to ‘ping’ your site every X minutes/hours/days. Examples are: StatusCake, UptimeRobot, and Pingdom. This is the recommended initial solution by many large WordPress companies, including WooCommerce.
- Disable WP Cron and set a proper cron to run in your hosting control panel (where available). You may wish to use the excellent WP Crontrol plugin to find out which crons are running and when so that you can accurately replicate them.
- Use a 3rd party cron service, such as SetCronJob or EasyCron.
Still having issues?
If you’re still having trouble, it’s possible that your host has disabled WP Cron in WordPress’s wp-config.php file. If this is the case, they may have replaced it with a proper cron running on the server instead. Either way, you may need to get in touch with them to help understand what’s going on.