WordPress Development

WP-Cron Explained: Why Scheduled Tasks Fail and How to Fix Them

WP-Cron Explained: Why Scheduled Tasks Fail and How to Fix Them

“My scheduled post didn’t publish.” “The backup plugin says the last backup was a week ago.” “Subscription renewals ran hours late.” These sound like three different problems, but they often have the same cause: WP-Cron, the system WordPress uses to run scheduled tasks.

WP-Cron is clever in a way that makes it work on almost any hosting, but that same cleverness makes it unreliable on some sites and wasteful on others. Once you understand how it works, the fixes are straightforward.

What WP-Cron does

WordPress and its plugins need to do things on a schedule:

  • Publish posts scheduled for a future time.
  • Check for updates to core, plugins and themes.
  • Delete old transients and trashed items.
  • Send scheduled emails and newsletters.
  • Run backups.
  • Process WooCommerce subscription renewals, scheduled sales and stock tasks.
  • Sync data with external services.

Each of these is registered as a cron event with a hook name, a next run time and optionally a recurrence, such as hourly, twice daily or daily.

How it actually runs

Here’s the important part. WP-Cron isn’t a real scheduler. Nothing on the server wakes up at the scheduled time. Instead, on page loads, WordPress checks whether any events are due. If they are, it fires a separate, non-blocking request to wp-cron.php on the same site, which runs the due events in the background.

This design has a clear benefit: it works on cheap shared hosting with no access to the server’s real cron system. But it creates two opposite problems.

Problem 1: low-traffic sites miss tasks

If nobody visits the site, nothing triggers WP-Cron. A post scheduled for 9 a.m. on a quiet site might not publish until the first visitor arrives at 11:40. A daily backup might skip days entirely. Page caching makes this worse, because cached pages are served without WordPress loading at all, so WP-Cron never gets the chance to check.

Problem 2: high-traffic sites waste resources

On busy sites, the check happens constantly. WordPress uses a short lock to avoid running events repeatedly, but the overhead of checking and spawning requests still adds up. And heavy tasks can end up running at peak times, slowing down real visitors.

Problem 3: the loopback request fails

The background request WordPress makes to itself, called a loopback request, sometimes fails. Causes include firewall rules, security plugins blocking requests to wp-cron.php, basic authentication on staging sites, misconfigured DNS on the server or SSL problems. When the loopback fails, cron events never run at all, regardless of traffic. Site Health in the WordPress dashboard reports loopback failures, so it’s worth checking there first.

The fix: use a real system cron

On any server where you can create scheduled tasks, the most reliable solution is to disable the visitor-triggered behaviour and run WP-Cron on a fixed schedule.

First, add this to wp-config.php:

This stops WordPress from triggering cron on page loads. It doesn’t disable scheduled tasks; it just means you’ll run them another way.

Then create a system cron job. Using WP-CLI is the cleanest method:

This runs every five minutes, executes any due events and exits. Running through WP-CLI avoids web server timeouts, doesn’t depend on loopback requests and doesn’t use a web worker.

If WP-CLI isn’t available, you can call wp-cron.php over HTTP instead:

This still goes through the web server, so it’s subject to timeouts and firewall rules, but it works on many shared hosts that offer a cron feature in the control panel.

How often should it run?

Every five minutes suits most sites. Busy stores with subscriptions or time-sensitive tasks might run every minute. Simple brochure sites could run every fifteen minutes. The frequency is just the maximum delay before a due task runs.

Multisite networks

On Multisite, each site in the network has its own cron events. You need to run cron for every site:

Put this in a small script and call the script from the system cron.

Inspecting cron events

WP-CLI lets you see exactly what’s scheduled:

This is a revealing command on older sites. You’ll often find:

  • Events from plugins that were removed years ago, still scheduled.
  • The same event scheduled hundreds of times because of a plugin bug.
  • Events whose next run time is far in the past, showing that cron hasn’t been running.
  • Suspicious hooks with random names, sometimes a sign of malware using cron to reinfect a site.

You can run a specific event to test it, or delete one that shouldn’t be there:

Plugins with a dashboard interface for viewing and managing cron events can also help, especially if you don’t have command line access.

Action Scheduler: cron for heavy lifting

WooCommerce and many other plugins use a library called Action Scheduler for background jobs. It stores tasks in its own database tables, processes them in batches and keeps a log of what ran, what failed and why.

Action Scheduler is triggered by WP-Cron by default, plus additional async requests on admin page loads. So if WP-Cron isn’t running, Action Scheduler tasks pile up too. Symptoms include subscription renewals not processing, webhooks not firing and emails from some plugins being delayed.

You can view the queue in WooCommerce under Status, then Scheduled Actions. Look for large numbers of pending or past-due actions, and for failed actions with error messages.

WP-CLI can also run the queue directly, which is useful on busy stores:

On high-volume stores, I sometimes run this from its own system cron job, so background processing doesn’t wait for anything else.

Common cron problems and fixes

Scheduled posts show “Missed schedule”

Usually WP-Cron isn’t being triggered: low traffic, aggressive page caching or a failing loopback. Switch to a system cron.

Cron events never run

Check Site Health for loopback errors. Check whether a security plugin or firewall blocks wp-cron.php. On staging sites protected with a password, loopback requests fail unless they’re allowed through. Again, a system cron with WP-CLI avoids all of this.

Cron runs, but tasks time out

Heavy tasks running through wp-cron.php over HTTP can hit PHP or web server timeouts. Running cron through WP-CLI removes web timeouts. For really long tasks, plugins should break work into batches, ideally using Action Scheduler.

The server slows down at certain times

Look at what’s scheduled at those times. Backups, imports and large sync tasks are common culprits. Reschedule them for quiet periods, or limit how much each run processes.

Thousands of duplicate events

A plugin is scheduling an event without checking whether it already exists. The correct pattern is:

If you find duplicates from a third-party plugin, report it to the developer and clean up the events.

Writing reliable cron tasks in your own code

If you build custom functionality that runs on a schedule:

  • Schedule on activation, unschedule on deactivation. Don’t leave orphaned events behind.
  • Check before scheduling to avoid duplicates.
  • Keep tasks short. Process a limited batch each run, and continue next time.
  • Make tasks safe to run twice. Cron isn’t guaranteed to run exactly once, so a task that sends emails or charges cards must check whether the work has already been done.
  • Log failures so problems don’t stay hidden.

For anything heavier than a quick task, consider Action Scheduler, which gives you batching, retries and visibility out of the box.

Monitoring cron

Because cron failures are silent, monitoring helps. Some uptime services offer “heartbeat” monitoring: your cron job pings a URL each time it runs, and you get an alert if the pings stop. Adding a ping to the end of your system cron command is a simple way to know cron is still working.

Frequently asked questions

Is it safe to disable WP-Cron?

Only if you replace it with a real system cron. DISABLE_WP_CRON stops the automatic trigger. Without a replacement, scheduled tasks stop running entirely, including security update checks.

Why does my scheduled post say “Missed schedule”?

WordPress tried to publish it but WP-Cron didn’t run at the right time, usually because of low traffic, caching or a failed loopback request. A system cron fixes it.

Can I see what WP-Cron is doing?

Yes. wp cron event list shows every scheduled event, and plugins can display them in the dashboard. For WooCommerce and Action Scheduler tasks, check Status, then Scheduled Actions.

How often should the system cron run?

Every five minutes is a good default. Stores with time-critical tasks may use every minute; simple sites can use longer intervals.

Final thoughts

WP-Cron is a clever workaround that keeps WordPress working on any hosting, but it’s at the mercy of traffic, caching and loopback requests. On any site where reliability matters, disable the visitor-triggered behaviour, run cron from the server on a fixed schedule, inspect your scheduled events every so often and keep an eye on Action Scheduler queues. Your posts will publish on time, your backups will run and your store’s background tasks will stop surprising you.