Blog
SavedSearch
Visit Hostlelo

Replace WP-Cron With a Real cPanel Cron Job

WP-Cron only runs when someone visits your site, so scheduled posts and backups can run late. Here is how to hand the schedule to a real server cron job.

The short answer

WP-Cron only checks for due tasks when a page loads, so on quiet sites scheduled posts and backups can run hours late. Add define( 'DISABLE_WP_CRON', true ); to wp-config.php, then create a cPanel cron job that calls wp-cron.php or runs wp cron event run --due-now every 15 minutes. Test it by scheduling a post and confirming it publishes on time.

A website calendar moving from irregular visitor-triggered checks to a server clock with evenly spaced successful cron runs.
Reading options

On this page

Before you start

cPanel File Manager, Terminal or SSH access; the exact absolute path to the WordPress install; a unique private wp-config.php backup stored outside public_html; a quiet change window; and a tested way to remove the cron job and restore the saved file.

WordPress does not have a clock running in the background. Its built-in scheduler, WP-Cron, only checks for due tasks when someone loads a page, so on a quiet site a post set for 2:00 PM can sit waiting until the next visitor arrives. The fix is to switch off that page-load trigger and let the server's own scheduler call WordPress on a fixed timetable.

The official Plugin Handbook puts it plainly: if you schedule a task for 2:00 PM and no page loads occur until 5:00 PM, scheduling errors could occur. Nothing is lost, it just runs late, and late is a problem when the task is a newsletter, a sale ending or a nightly backup.

By the end of this guide you will be able to turn off WP-Cron's page-load trigger, set up a real cron job in cPanel or with WP-CLI, and prove that it is firing on time.

What WP-Cron actually is

WP-Cron is WordPress's internal to-do list for timed jobs. Publishing scheduled posts, checking for updates, sending plugin emails and running some backup plugins all go through it. The handbook says it works "by checking, on every page load, a list of scheduled tasks to see what needs to be run."

Think of a shop assistant who only checks the reminder board when the shop door opens. On a busy day the door opens every minute and nothing gets missed. On a slow Sunday nobody walks in until evening, so the 10 AM reminder to call a supplier is read at 6 PM. The reminder was never lost. It just waited for the door.

A system cron is a different thing. Cron is the scheduler built into Linux servers: it runs commands at set times whether or not anyone visits your site. Pointing that at WordPress is like giving the shop assistant an alarm clock.

Why this matters: the handbook confirms that missed tasks are not thrown away. They are queued and run at the next page load. You can be sure a task runs eventually, but you cannot be sure when.

Before you start

  • You can log in to cPanel for the account that hosts the site.
  • You have a fresh copy of wp-config.php saved on your own computer.
  • You know the absolute path to your WordPress folder, for example /home/exampleuser/public_html (yours will differ).
  • You know your site address, for example https://example.com.
  • You are working on a test site, or at a quiet hour when a short hiccup will not hurt anyone.
  • You have checked whether your hosting plan limits how often cron jobs may run.

Heads up: wp-config.php controls how WordPress connects to its database. A typo in it can take the whole site offline with a blank page or a fatal error. That is why the backup comes first, and why you should keep the original file open somewhere you can paste it back from.

Switch off WP-Cron's page-load trigger

This part tells WordPress to stop checking its to-do list on every visit. You will replace that trigger with a real schedule in the next section, so do both on the same day.

Step 1: Back up wp-config.php

The handbook says wp-config.php "is located in the root of your WordPress file directory," meaning the top folder of your install, the one that also holds wp-admin and wp-content.

Open File Manager in cPanel, go to your WordPress folder, select wp-config.php, and download it to a private local folder. Record the time and location. Do not leave a .php backup inside public_html; a PHP-handler or server misconfiguration could expose database credentials and security salts.

If you have SSH access, this command makes a unique private copy outside public_html.

WP_CONFIG_BACKUP="/home/exampleuser/wp-config.before-cron.$(date +%Y%m%d-%H%M%S)"
umask 077
cp -- /home/exampleuser/public_html/wp-config.php "$WP_CONFIG_BACKUP"
printf 'Backup saved to %s\n' "$WP_CONFIG_BACKUP"

Record the exact path printed by the last command. It sits outside public_html and the restrictive umask keeps the copy private. For rollback, replace the timestamp below with that exact printed path; do not paste the placeholder literally:

cp -- /home/exampleuser/wp-config.before-cron.YYYYMMDD-HHMMSS /home/exampleuser/public_html/wp-config.php

Confirm that the printed backup path exists outside public_html. If anything goes wrong later, restore that exact file over wp-config.php.

Quick tip: keep the backup outside the web root during validation, then delete it according to your retention policy after the change is stable. Never move a wp-config.php backup into a public folder.

Step 2: Add the DISABLE_WP_CRON line

Open wp-config.php for editing. Near the bottom you will find a comment that reads That's all, stop editing! Happy blogging. Add your new line above that comment, so it sits before the file loads wp-settings.php.

This is the exact line the WordPress handbook gives for turning off the page-load trigger.

define( 'DISABLE_WP_CRON', true );

Save the file, then load your homepage in a private browser window. The site should look exactly as it did before. If you see a blank page or an error, restore the exact backup path printed in Step 1, reload the site, and check the line for a missing quote or semicolon.

Why this matters: the handbook says leaving the page-load check in place once a system scheduler is running is unnecessary and "will contribute to extra resource usage on your server." Every visit would still ask WordPress to look at its to-do list.

Heads up: DISABLE_WP_CRON does not delete your scheduled tasks. It only stops visits from triggering them. Until you add the server cron in the next section, nothing will run at all, so do not stop halfway.

Add a real cron job in cPanel

Now you give WordPress its alarm clock. The cPanel documentation describes this in the Cron Jobs interface in cPanel. Open that interface from your cPanel home screen. Your host's theme decides where the icon sits, so use the search box at the top of cPanel and type "cron" if you do not spot it.

Step 3: Choose how often it runs

The Cron Jobs interface offers a Common Settings menu that fills in the time fields for you, or you can type values into Minute, Hour, Day, Month and Weekday yourself. cPanel's docs say you must fill in all of those plus the Command box.

For most sites, every 15 minutes is a sensible starting point. The handbook uses that same interval in its example. In cron's notation that is */15 in the Minute field and * in the other four. The asterisk means "every", so the line reads as "every 15 minutes, every hour, every day".

Made-up example: a recipe blog with a few hundred visits a day (numbers invented for illustration) schedules posts for 6:00 AM. Overnight, nobody visits. With WP-Cron alone, the post waits for the first early riser. With a 15-minute server cron, it goes live by 6:15 AM at the latest, even if nobody is awake.

Heads up: do not set it to every minute just because you can. cPanel's docs warn that if jobs run too often, the server can start a new one before the last one finishes, and that duplication can slow the server down. Some hosts also set their own minimum interval.

Step 4: Enter the command

cPanel tells you to specify the absolute path to the command you want to run. An absolute path is the full address of a file starting from the top of the server, such as /usr/bin/wget, rather than just wget.

This command asks your site to run its due tasks by requesting wp-cron.php, and then throws away the response instead of saving it as a file.

wget --delete-after https://example.com/wp-cron.php >/dev/null 2>&1

Replace example.com with your own domain. The --delete-after part comes straight from the handbook, which notes that without it wget would save the output of each request. On a 15-minute schedule that is close to a hundred stray files a day in your home folder.

The >/dev/null 2>&1 on the end sends all output into nowhere. cPanel's docs say adding this to a job stops it sending you an email every time it runs. Without it, a 15-minute job can fill your inbox fast.

If your host wants the full path to wget and you have SSH or cPanel's Terminal, this command prints where wget lives on your server.

command -v wget

Use whatever path it prints in place of plain wget in the job. If it prints nothing, wget is not installed for your account and you should use the WP-CLI method below or ask your host.

Step 5: Save and confirm

Click Add New Cron Job. The job should now appear in the Current Cron Jobs table further down the page, with your timing and command listed.

To change it later, cPanel's docs say to click Edit next to the job, adjust it, and click Edit Line. To remove it, click Delete and confirm.

Quick tip: while you are testing, you can leave off >/dev/null 2>&1 and put your email address in the Cron Email section. You will get one email per run showing any errors. Once it works, add the redirect back so the emails stop.

Variant: run cron with WP-CLI instead

WP-CLI is the official command-line tool for WordPress. Many cPanel hosts install it, and it lets you run due tasks directly on the server without going through a web request at all.

Step 6: Check that WP-CLI is available

If you have SSH or Terminal access, this command checks whether WP-CLI is installed and where it lives.

command -v wp

You should see a path such as /usr/local/bin/wp. If you see nothing, WP-CLI is not available to your account. Stick with the wget method or ask your host whether they offer it.

Step 7: Use wp cron event run as the cron command

At the time of writing (16 November 2026), the WP-CLI docs describe wp cron event run --due-now as running "all hooks due right now." A hook here is simply the name of one scheduled task. The docs add that it respects the doing_cron lock, a marker WordPress sets while cron is running, to prevent overlapping runs.

This command runs every task that is due, for the WordPress install at the given path, and discards the output.

/usr/local/bin/wp cron event run --due-now --path=/home/exampleuser/public_html >/dev/null 2>&1

Swap in the path that command -v wp gave you and your own WordPress folder. The --path option is a global WP-CLI setting that tells it where WordPress lives, which matters because cron does not start in your site folder.

Paste that into the Command box in cPanel with the same */15 timing and click Add New Cron Job. You still need DISABLE_WP_CRON set in wp-config.php.

Why this matters: the wget method makes a public web request to your own site. The WP-CLI method runs inside the server, so a firewall rule, a password-protected staging site or a CDN that blocks bots cannot get in its way.

Variant: a plain Linux VPS

If you run your own server without cPanel, you edit the crontab directly. The crontab is the per-user file that lists cron jobs, one per line. The handbook notes you usually open it with crontab -e.

This opens your user's crontab in a text editor.

crontab -e

Each line has five time fields followed by the command. According to the crontab man page, they are minute (0 to 59), hour (0 to 23), day of month (1 to 31), month (1 to 12) and day of week (0 to 7, where both 0 and 7 mean Sunday). Everything after those five fields is treated as the command.

This line runs the WP-CLI command every 15 minutes as the site's own user.

*/15 * * * * /usr/local/bin/wp cron event run --due-now --path=/var/www/example.com >/dev/null 2>&1

Add the crontab as the user that owns the WordPress files, not as root. Running WordPress tasks as root can leave files owned by root that the site later cannot write to.

Heads up: the man page says an unescaped % in a cron command is turned into a newline. If you ever add a date-stamped log file name with %, escape each one with a backslash or the job will break in a confusing way.

How to check it worked

Give the schedule one full cycle, about 15 minutes, before testing.

Step 8: Publish a test post on a schedule

In the WordPress dashboard, create a draft post titled "Cron test", set it to publish 10 minutes from now, and click Schedule. Do not visit the front of the site in the meantime.

Wait 25 minutes, then open the Posts screen. The post should show as Published. If it still says Scheduled well past its time, the server cron is not reaching WordPress. Jump to Troubleshooting.

Step 9: Look at the task list with WP-CLI

If you have WP-CLI, this lists every scheduled task with its next run time.

wp cron event list --path=/home/exampleuser/public_html

You should see a table with columns including hook, next_run_gmt, next_run_relative and recurrence. The next_run_relative column should show times in the future. A long list of overdue tasks after a full cycle suggests the cron job is not running.

Step 10: Check that wp-cron.php answers

For the wget method, this asks the server for just the headers of wp-cron.php, which tells you whether the request gets through.

curl -I https://example.com/wp-cron.php

Use your own domain in place of example.com. You are hoping for a first line with a 200 status. A 403 means something is blocking the request, and a 404 usually means the URL is wrong, for example WordPress lives in a subfolder.

Quick tip: the command wp cron test tests WordPress's cron spawning system. Its docs say it errors when DISABLE_WP_CRON is set, so after this change an error there is expected and fine. It is not a test of your new server job.

Troubleshooting

Scheduled posts still publish late

Symptom: posts stay in Scheduled status long after their time, even though the cron job exists.

Likely cause: the job's command has a typo, points at the wrong domain, or uses http:// on a site that redirects to https://.

Fix: copy the domain straight from your browser's address bar. Temporarily remove >/dev/null 2>&1, set the Cron Email address, and read the error the next run sends you.

"command not found" in the cron email

Symptom: the cron email says something like wget: command not found or wp: command not found.

Likely cause: cron runs with a shorter list of folders to search than your SSH session, so a program you can run by name in Terminal is invisible to cron.

Fix: run command -v wget or command -v wp and use the full path it prints in the job. If neither exists for your account, ask your host which tool they support.

403 Forbidden on wp-cron.php

Symptom: curl -I returns a 403, or the cron email shows 403 Forbidden.

Likely cause: a security plugin, firewall rule or bot filter is blocking automated requests to wp-cron.php, or the site sits behind a password.

Fix: switch to the WP-CLI variant, which skips the web request entirely. If you must use wget, ask whoever manages the firewall to allow requests from your server's own address, for example 192.0.2.10.

The site went blank after editing wp-config.php

Symptom: a white page or a critical error message right after Step 2.

Likely cause: a missing quote, bracket or semicolon, or the line was pasted below the require_once that loads WordPress.

Fix: restore the exact private backup path printed in Step 1, reload the site to confirm it is back, then add the line again carefully above the "stop editing" comment.

Your inbox is full of cron emails

Symptom: an email every 15 minutes from your server.

Likely cause: the command does not end with >/dev/null 2>&1, and an address is set in Cron Email.

Fix: click Edit on the job, add >/dev/null 2>&1 to the end of the command, and click Edit Line. cPanel's docs also say you can clear the Cron Email address to stop emails for every job.

Heavy tasks pile up or the account hits limits

Symptom: slow pages around each run, or resource warnings in cPanel.

Likely cause: the interval is too short for what your plugins do, so runs start before earlier ones finish.

Fix: stretch the interval to 30 minutes, or use the WP-CLI method, which respects WordPress's doing_cron lock. Our guide on reading cPanel resource usage and faults shows how to tell whether cron is the culprit.

Pro tips and security notes

Quick tip: if you run several WordPress sites on one account, give each its own cron job with its own --path or URL. One job does not cover them all.

Spread the start minutes out. Typing 5,20,35,50 in the Minute field for a second site keeps it from waking at the same moment as the first.

You may see advice to use ALTERNATE_WP_CRON instead. The handbook warns this "has certain risks, since it depends on a non-native WordPress service." A real server cron is the cleaner fix, so use that wherever your host allows it.

On security, wp-cron.php stays reachable from the web even with DISABLE_WP_CRON set, because the constant only stops WordPress triggering it on page loads. If you move fully to WP-CLI, that public request is no longer part of your setup. If you want to tighten other parts of wp-config.php while it is open, our piece on `DISALLOW_FILE_EDIT` versus `DISALLOW_FILE_MODS` is a good next read.

When to ask your host

Ask your host if the Cron Jobs interface is missing from cPanel, since the cPanel docs note it can be switched off at the server level. Ask too if neither wget nor WP-CLI is available, if your plan sets a minimum interval you need to know, or if the cron email shows errors you cannot place. Hosts see server logs you cannot, so a short ticket is often quicker than guessing.

After the switch, the Site Health screen may still flag scheduled event problems if something else is wrong. Our guide on what to fix first in WordPress Site Health helps you sort those by priority.

The one message worth forwarding

If you manage the site for someone else, or you want your developer or host to set this up, send this.

Hi, could you please move this WordPress site from WP-Cron to a real server cron job?

1. Back up wp-config.php first.
2. Add define( 'DISABLE_WP_CRON', true ); above the "That's all, stop editing!" comment.
3. In cPanel's Cron Jobs interface, add a job every 15 minutes running:
   wp cron event run --due-now --path=/full/path/to/wordpress >/dev/null 2>&1
   (or wget --delete-after https://example.com/wp-cron.php >/dev/null 2>&1 if WP-CLI is not available)
4. Schedule a test post 10 minutes ahead and confirm it publishes on time.

Thanks!

WordPress only keeps time when visitors show up, so hand the clock to the server and test it with one scheduled post.

Reader questions

Will disabling WP-Cron delete my scheduled posts or tasks?

No. The constant only stops page visits from triggering the scheduler. Your scheduled tasks stay in place and run when the server cron calls WordPress.

Can I set the cron job to run every minute?

You can if your host allows it, but cPanel's documentation warns that jobs scheduled too often can overlap and slow the server. Every 5 to 15 minutes is plenty for most sites.

Do I need a separate cron job for each WordPress site?

Yes. Each install has its own task list, so each needs its own job pointing at its own URL or folder path.

Does this work on WordPress multisite?

WP-CLI has a --network option for wp cron event run that runs hooks across all sites in a multisite installation. Check the WP-CLI documentation for your version before relying on it.

Is the wget method or the WP-CLI method better?

Both work. WP-CLI runs directly on the server and avoids firewalls or password protection blocking the request, so use it when your host provides it.

Should I use ALTERNATE_WP_CRON instead?

The WordPress handbook warns that ALTERNATE_WP_CRON has risks because it depends on a non-native service. A real server cron job is the better choice when your host allows one.

How do I undo this change?

Delete the cron job in cPanel and remove the DISABLE_WP_CRON line from wp-config.php. WordPress goes back to checking its task list on page loads.

Sources & further reading

  1. WordPress Plugin Handbook: Cron
  2. WordPress Plugin Handbook: Hooking WP-Cron Into the System Task Scheduler
  3. WordPress Developer Resources: Editing wp-config.php
  4. cPanel Documentation: Cron Jobs
  5. WP-CLI: wp cron
  6. WP-CLI: wp cron event run
  7. WP-CLI: wp cron event list
  8. WP-CLI: wp cron test
  9. crontab(5) Linux manual page

What changed

Safety review on 16 November 2026: moved the wp-config.php backup workflow outside public_html, removed stale same-folder instructions and the predictable dated filename, corrected the literal newline in the verification command, added an exact rollback path, refreshed dated references, and added an original accessible cover.

Originally published . About our editorial updates.

Your next project deserves a better foundation.

Explore hosting built for your next chapter.

Explore hosting

Find your next answer.

Search published guides and articles.

Ctrl / ⌘ K to open · Esc to close