The WordPress WP-Cron system is a decently okay faux cron system, but it has its problems, such as running on frontend requests and not running if no requests are coming through.
WP-Cron works by: on every page load, a list of scheduled tasks is checked to see what needs to be run. Any tasks scheduled to be run will be run during that page load. WP-Cron does not run constantly as the system cron does; it is only triggered on page load. Scheduling errors could occur if you schedule a task for 2:00PM and no page loads occur until 5:00PM.From the WordPress Plugin Handbook
These are problems because:
- A heavy cron event can cause severe slowdown on random frontend requests, hurting page speeds.
- Not running without requests can be bad for sites that are infrequently updated and heavily cached.
The solution to this is to disable the built-in cron firing that’s done with pageviews, and use a system cron (or other service) to poll for cron events.
Disabling the cron firing is done by adding this to the
For this site specifically, I use the “Cron Jobs” system of DreamHost to run this WP-CLI command every 10 minutes:
This forces the cron to run and check for ready jobs every 10 minutes. It’s possible that some cron events might run later than they “should” but in practice, I’ve seen this running more cron jobs than if I relied on page loads.