How to replace WP-Cron with a real cron job
WP-Cron is how WordPress runs scheduled work: publishing a post at 09:00, sending a newsletter, taking a backup. It has one big catch: it only runs when someone visits your site. On a quiet site, or behind a cache, tasks run late or not at all, and WordPress does not tell you. The fix is old and simple: let a real scheduler start those tasks instead. In short Have a real scheduler call…
WordPress employs WP-Cron to handle scheduled tasks such as publishing posts, sending newsletters, and taking backups. However, WP-Cron can only execute these tasks when a visitor accesses the site. During periods of low traffic or when a site is behind a cache, these tasks may run late or fail to execute at all. WordPress does not provide any notification of these issues. The remedy to this problem is straightforward: use a genuine scheduler to initiate the tasks.
To implement this solution, first, establish a real scheduler. This can be done by employing a crontab on your server, utilizing the hosting control panel's scheduled tasks feature, or relying on an external cron service. Once the real scheduler is in place, modify the wp-config.php file by adding the following line above the comment indicating the end of editing:
define( 'DISABLE_WP_CRON', true );
After making this change, verify that the tasks are running on time and there are no overdue tasks. The WP-Cron system operates by checking the list of scheduled tasks on each page load. If a task is due, it sends a request to wp-cron.php on the same site, which in turn runs the task. This makes WP-Cron a mere check that accompanies visitor traffic, rather than an actual timer.
Indications that your site may be experiencing problems include messages about missed schedules, a backlog of pending WooCommerce scheduled actions, delayed emails, or a Site Health warning about late scheduled events. To confirm that the new setup is functioning correctly, use the WP Crontrol plugin. There should be no overdue events, and scheduling a test post a few minutes ahead should result in it going live without any page visits.
A 401 or 403 response from wp-cron.php typically signals a firewall or password protection blocking the call, while a 500 response indicates an error within a plugin's task. The entire process, including considerations for multisite, Cloudflare, and managed hosting, can be found in the detailed guide on cronengine.com.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.