All posts

Blog

WP-Cron vs Real Cron: How to Disable WP-Cron and Set Up a Server Cron Job

Illustrated cover for the WordPress guide "WP-Cron vs Real Cron: How to Disable WP-Cron and Set Up a Server Cron Job"

Scheduled posts that never go live. Backups that run at random times. A busy site that feels sluggish for no obvious reason. These problems often trace back to the same quiet piece of WordPress: WP-Cron.

In this guide you will learn what WP-Cron does, why it can be unreliable, and how to disable it and set up a real server cron job instead. The whole process takes about ten minutes.

What is WP-Cron?

WordPress needs to run tasks on a schedule. Examples include:

  • Publishing posts you scheduled for a future date
  • Checking for core, plugin and theme updates
  • Running backup, security scan or cleanup plugins
  • Sending scheduled emails or newsletters
  • Clearing expired data in a store or membership plugin

On a normal server, scheduled tasks are handled by cron, a system service that runs commands at set times. But WordPress has to work on every kind of hosting, including setups where users cannot create cron jobs. So it ships with its own system, WP-Cron, in a file called wp-cron.php.

How WP-Cron actually works

WP-Cron is not a true timer. Instead, on each page load WordPress checks whether any scheduled task is due. If one is, it fires off a background request to wp-cron.php to run it.

That design has two consequences.

Low-traffic sites miss schedules

If nobody visits your site at 9:00 AM, a post scheduled for 9:00 AM will not publish until the next visit. On a quiet site that could be hours later. You may have seen the "Missed schedule" label in your post list because of this.

High-traffic sites do extra work

On a busy site, WordPress checks the schedule on page loads constantly, and the extra requests to wp-cron.php add load. When heavy tasks run during a traffic spike, visitors can feel it.

When should you switch to a real cron job?

Replacing WP-Cron is a good idea if:

  • Scheduled posts are published late or show "Missed schedule"
  • You run a store, membership site or anything with time-sensitive tasks
  • Your site gets steady traffic and you want to reduce server load
  • You use page caching that serves visitors without loading WordPress, which can mean WP-Cron rarely triggers at all

For a small brochure site with no scheduled content, leaving WP-Cron alone is fine.

Step 1: Disable WP-Cron in wp-config.php

Open wp-config.php in your site's root folder using your hosting file manager or SFTP. Above the line that says /* That's all, stop editing! */, add:

define( 'DISABLE_WP_CRON', true );

Save the file. WordPress will no longer trigger scheduled tasks on page loads. Do not stop here, or nothing scheduled will run at all. Move on to step 2 right away.

Step 2: Create a real cron job

In cPanel

  1. Log in to cPanel and open Cron Jobs in the Advanced section.
  2. Under Add New Cron Job, choose a common setting such as Once Per Five Minutes, or Once Per Fifteen Minutes for lighter sites.
  3. In the Command field, enter one of the commands below.
  4. Click Add New Cron Job.

In DirectAdmin

  1. Open Cron Jobs under Advanced Features.
  2. Set the timing fields. For every five minutes, put */5 in the minute field and * in the others.
  3. Enter the command and click Create.

Which command to use

Option A: Run it with PHP directly (preferred when available)

cd /home/USERNAME/public_html && php -q wp-cron.php >/dev/null 2>&1

Replace the path with the real path to your WordPress folder. Your control panel's file manager shows the full path. On some servers you need the full path to PHP, such as /usr/local/bin/php. Your host can confirm it.

Option B: Call it over the web

wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

or

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

This works almost anywhere but goes through the web server, so firewall or security plugin rules can occasionally block it.

Option C: WP-CLI

If WP-CLI is installed, this runs only the events that are due:

cd /home/USERNAME/public_html && wp cron event run --due-now >/dev/null 2>&1

The >/dev/null 2>&1 part stops the cron service from emailing you output every time it runs.

How often should the cron job run?

  • Every 5 minutes: good for stores, membership sites and sites with lots of scheduled content.
  • Every 15 minutes: fine for most blogs and business sites.
  • Hourly: acceptable if you only need daily backups and update checks.

Some hosts set a minimum interval, so check if your preferred timing is rejected.

Step 3: Confirm it works

  • Schedule a test post a few minutes in the future and confirm it publishes on time.
  • Install a cron viewer plugin such as WP Crontrol to see upcoming events and when they last ran.
  • Check Tools → Site Health. It warns you if scheduled events are failing or running late.

Troubleshooting

Scheduled posts still miss their time

Double-check the folder path in the command. A typo means cron runs, but in the wrong place. Also confirm the DISABLE_WP_CRON line is above the "stop editing" comment.

The web request option returns an error

A security plugin or firewall may be blocking requests to wp-cron.php. Whitelist it, or switch to the PHP command.

Multisite networks

On WordPress multisite, each site in the network has its own cron queue. The WP-CLI approach can loop through sites, or you can create a cron job for each site's URL.

Wrap-up

WP-Cron is a clever workaround, but it depends on visitors to keep time. Disabling it in wp-config.php and adding a real cron job in cPanel or DirectAdmin gives you scheduled posts that publish on time, more predictable background tasks and less unnecessary load. It is a small change that makes a WordPress site noticeably more dependable.