Developers Tutorial Intermediate 3 min

WP-Cron Explained: Why Scheduled Tasks Run Late and How to Fix It

WordPress runs scheduled tasks only when someone visits. That's why posts miss their publish time and background jobs pile up. How WP-Cron works, how to see what's scheduled and how to run it from a real cron job.

TutorialIntermediate20 minTested on WordPress 7.1Updated November 13, 2026

“Missed schedule” next to a post that should have gone live an hour ago is one of the most common WordPress puzzles. The post is fine, the date is right, and yet nothing happened. The reason is how WordPress runs anything on a schedule.

How WP-Cron actually works

A real cron is a program on the server that wakes up at set times. WordPress can’t rely on having one, so it fakes it. On each page load, WordPress checks its list of scheduled events. If any are due, it sends a request to its own wp-cron.php in the background, and that request runs them.

That has two consequences:

  • No visitors, no tasks. If nobody visits between 3:00 and 7:00, a post scheduled for 3:00 publishes at 7:00, when the first visitor arrives.
  • Busy sites do extra work. Every page load checks the schedule, and the background request uses a PHP worker your visitors could have used.

WordPress itself schedules plenty: publishing posts, checking for updates, deleting old trash, sending some emails. Plugins add their own. WooCommerce runs its background jobs (emails, webhooks, scheduled sales) through Action Scheduler, which by default is also kicked off by WP-Cron.

See what’s scheduled

Before changing anything, look at the list. This adds a read-only Tools → Cron Events page showing every event, when it runs next and how often:

Snippet

List Scheduled Cron Events Under Tools

Add a read-only Tools > Cron Events page that lists every scheduled WP-Cron task, when it runs next and how often.

PHPIntermediate
View

With WP-CLI, you can get the same list in the terminal:

TerminalBASH
wp cron event list --fields=hook,next_run_relative,recurrence
Events showing as overdue?

A few seconds or minutes is normal. Events overdue by hours mean WP-Cron isn’t being triggered. Also check Tools → Site Health: if it reports that loopback requests fail, WordPress can’t call its own wp-cron.php, and nothing scheduled will run.

Run WP-Cron from a real cron job

This is the proper fix. It needs two parts, and the order matters.

  1. Add a cron job on your server

    Most hosts have a Cron jobs or Scheduled tasks section in their control panel. Add a job that runs every 5 minutes. If your host has WP-CLI, use it:

    functions.phpBASH
    */5 * * * * cd /path/to/your/site && wp cron event run --due-now >/dev/null 2>&1

    Otherwise, call wp-cron.php over HTTP:

    functions.phpBASH
    */5 * * * * curl -s "https://example.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1

    Replace the path or domain with your own.

  2. Stop WordPress triggering it on page loads

    Only once the cron job is running, add the constant to wp-config.php:

    wp-config.phpPHP
    // In wp-config.php: stop WordPress triggering cron on page loads.
    define( 'DISABLE_WP_CRON', true );
    
    // Then add a server cron job that runs every 5 minutes, for example:
    // */5 * * * * wget -q -O - "https://example.com/wp-cron.php?doing_wp_cron" >/dev/null 2>&1
    // or, with WP-CLI:
    // */5 * * * * cd /path/to/site && wp cron event run --due-now >/dev/null 2>&1
    Tested on WordPress 7.1 · PHP 8.3Add to: wp-configChecked November 13, 2026
  3. Check it’s working

    Wait ten minutes, then look at Tools → Cron Events again. Nothing should be overdue by more than a few minutes.

Don't add the constant first

With DISABLE_WP_CRON set and no cron job, nothing scheduled runs at all: no scheduled posts, no WooCommerce emails, no update checks.

How often?

Every 5 minutes suits most sites. WooCommerce stores with lots of scheduled actions may want every minute.

No server cron? Fix missed posts at least

Some shared hosting doesn’t allow cron jobs. In that case, this snippet checks for scheduled posts that missed their time and publishes them, at most once every five minutes, so it doesn’t add a query to every page:

Snippet

Fix Missed Scheduled Posts on Shared Hosting

Trigger WordPress's missed schedule check on every front-end page load so scheduled posts publish reliably on shared hosting where WP-Cron doesn't fire consistently.

PHPIntermediate
View

It only rescues posts. Other scheduled tasks still depend on visitors.

Schedule your own tasks

If you’re writing a plugin or a site snippet, schedule work through WP-Cron rather than running it on page loads. This adds an “every 15 minutes” interval and a task that uses it, with the clean-up for when the code is removed:

functions.phpPHP
add_filter( 'cron_schedules', function ( array $schedules ): array {
	$schedules['nahnu_15_minutes'] = [
		'interval' => 15 * MINUTE_IN_SECONDS,
		'display'  => 'Every 15 minutes',
	];
	return $schedules;
} );

// Schedule the task once. WordPress keeps it scheduled after that.
add_action( 'init', function (): void {
	if ( ! wp_next_scheduled( 'nahnu_every_15_minutes' ) ) {
		wp_schedule_event( time() + MINUTE_IN_SECONDS, 'nahnu_15_minutes', 'nahnu_every_15_minutes' );
	}
} );

// The task itself.
add_action( 'nahnu_every_15_minutes', function (): void {
	delete_expired_transients();
} );
Tested on WordPress 7.1 · PHP 8.3Checked November 13, 2026

Two habits that save trouble later: always check wp_next_scheduled() before scheduling, so you don’t add the same event on every page load, and unschedule your events when your plugin is deactivated.

Summary

WP-Cron runs scheduled tasks when someone visits, which is why they run late on quiet sites. Look at what’s scheduled first. Then set up a server cron job and, once it runs, add DISABLE_WP_CRON. If your host doesn’t offer cron jobs, use the missed-posts snippet so at least your posts publish on time.

Check your understanding

1A post scheduled for 3:00 publishes at 7:00 on a quiet site. Why?
2What happens if you add DISABLE_WP_CRON without a server cron job?

Was this helpful?

Written by Nahnu Plugins

We build and maintain WordPress plugins. Every guide is tested on a fresh WordPress site before it goes out, and checked again when WordPress updates.

More guides

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only