Skip to content

WP-Cron

WP-Cron is WordPress's scheduler. It publishes scheduled posts, checks for updates and runs plugins' timed jobs. It has no clock of its own. Page loads start it, so on a quiet site, or one that cannot reach itself, tasks run late or not at all.

By
WP Ministry
Published

In short

  • WP-Cron runs when a page is loaded, not at a set time. A task that falls due waits for the next visit.
  • DISABLE_WP_CRON in wp-config.php stops page loads from starting it. That is right only when a cron job on the server requests wp-cron.php instead.
  • `wp cron event list` shows every task and when it runs next. `wp cron event run --due-now` runs what is waiting.

WP-Cron is the part of WordPress that runs tasks at a set time. WordPress uses it to publish scheduled posts and to check for updates. Plugins use it for timed jobs of their own, such as a backup. The name comes from cron, the scheduler on Unix servers, but WP-Cron has no clock.

A task runs only after someone loads a page. WordPress's handbook says WP-Cron "is only triggered on page load". On each load WordPress checks its list of tasks. If one is due, it sends a request to its own wp-cron.php file, which runs it. The handbook's example: a task set for 2:00 PM on a site nobody visits until 5:00 PM runs at 5:00 PM. It is late, not lost.

The handbook and the code differ on one detail. The handbook says a due task is called during that page load. The current source, wp-includes/cron.php, makes the check at the end of the request (since WordPress 6.9) and runs the task in a separate request to wp-cron.php, at most once every 60 seconds, so a visitor does not wait for it. The source is what your site runs.

Where you meet it

  • wp-cron.php, in the folder WordPress is installed in. In the server's access log its requests read wp-cron.php?doing_wp_cron= followed by a number.
  • define( 'DISABLE_WP_CRON', true ); in wp-config.php. The line stops page loads from starting WP-Cron. The handbook gives it as the last step, after the server's own scheduler has been set to request wp-cron.php.
  • Tools, then Site Health. A healthy site lists "Scheduled events are running" among its passed tests. A site in trouble shows "A scheduled event is late" or "A scheduled event has failed".
  • The Posts screen. A scheduled post whose time has passed shows "Missed schedule".

What goes wrong

  • A quiet site runs late. With no page loads, nothing starts the tasks. A scheduled post stays unpublished: see how to fix "Missed schedule". A plugin's nightly backup waits for the next visitor. How to schedule automatic backups shows how to put WP-Cron on a real clock.
  • It was switched off and nothing took its place. With DISABLE_WP_CRON set and no cron job on the server, no scheduled task is started at all. Set up the cron job first, then add the line.
  • The site cannot reach itself. WP-Cron depends on the site sending a request to its own address. Site Health calls this a loopback request and says such requests "are used to run scheduled events". If the server or a security rule refuses it, tasks stop while the site looks fine.
  • A heavy task slows the dashboard. The task runs as a request on the same server as your pages. The guide to a slow WordPress admin shows how to find one.
  • WooCommerce's background jobs stall with it. Action Scheduler, the queue WooCommerce uses, is started by WP-Cron once a minute. Without it, the queue moves only while someone is working in the dashboard.

How to look at yours

With WP-CLI, this lists every task, when it runs next and how often it repeats:

bash
wp cron event list

A new site lists wp_version_check, wp_update_plugins and wp_update_themes, each repeating every 12 hours. To run everything that is due now:

bash
wp cron event run --due-now

Common questions

Is WP-Cron the same as a cron job?

No. A cron job is run by the server's own scheduler at a set time, whether or not anyone visits. WP-Cron is part of WordPress and runs only after a page is loaded. The two are often combined: a cron job requests wp-cron.php at an interval you choose, and DISABLE_WP_CRON stops page loads from doing the same work.

Should I disable WP-Cron?

Only once something else requests wp-cron.php on a schedule. With the line in place and no cron job, scheduled posts, update checks and plugin schedules all stop.

Not sure what is wrong?

Tell us what you see. We reply with the cause and a fixed quote, and the diagnosis is free.