How to replace WP-Cron with a cPanel cron job
Help centreOn this page
This guide shows how to switch off WordPress’s built-in scheduler and have the server run it on a fixed timetable instead. It fixes missed scheduled posts and plugin tasks that run late or not at all.
Why WP-Cron misses tasks
WordPress has no clock of its own. Its scheduler, WP-Cron, only wakes up when someone loads a page. On each visit, WordPress checks whether any jobs are due and runs them.
That causes two problems:
- On a quiet site, jobs run late. If nobody visits between 2am and 9am, a post scheduled for 6am won’t publish until the first visitor turns up. Backups, emails and clean-up tasks from plugins are delayed in the same way.
- On a busy site, it checks too often. Every page view triggers a check, which adds a little work to each request.
A cPanel cron job fixes both. The server calls WP-Cron at set times whether or not anyone is visiting, and page views no longer have to do it.
Step 1: Turn off the built-in trigger
You need to add one line to your wp-config.php file. Take a copy of the file first so you can put it back if needed.
- Log in to cPanel and open File Manager.
- Go to the folder WordPress is installed in. For your main domain this is usually
public_html. - Right click
wp-config.phpand choose Edit. - Find the line that says
/* That's all, stop editing! Happy publishing. */. The wording differs slightly between versions. - Just above it, add this line:
define( 'DISABLE_WP_CRON', true );
- Click Save Changes.
If the file already has a DISABLE_WP_CRON line, change its value rather than adding a second one.
From now on, page views won’t start scheduled tasks. Nothing will run until you add the cron job in the next step, so don’t stop here.
Step 2: Add the cron job in cPanel
- In cPanel, open Cron Jobs in the Advanced section.
- Under Add New Cron Job, open the Common Settings list and choose Once Per Fifteen Minutes. If that option isn’t listed, type
*/15in Minute and*in the other four boxes. - In Command, enter one of the commands below.
- Click Add New Cron Job.
The first option runs the file directly with PHP. It doesn’t depend on your site loading over the web, so we suggest it:
/usr/local/bin/php /home/yourusername/public_html/wp-cron.php >/dev/null 2>&1
Replace yourusername with your cPanel username, which is shown in the right hand column of the cPanel home page. If WordPress lives in a subfolder or an addon domain folder, change the path to match.
The second option asks the server to fetch the page over the web, the same way a visitor would:
wget -q -O /dev/null "https://yourdomain.co.uk/wp-cron.php?doing_wp_cron" >/dev/null 2>&1
Use this one if a plugin needs WP-Cron to run in a normal web request, or if you’re not sure of the folder path.
For more on the cron screen and timing boxes, see how to set up a cron job.
Why every 15 minutes
Fifteen minutes is often enough for scheduled posts, plugin emails and routine clean-up, while keeping server load low. A shop or membership site with time sensitive tasks may want every five minutes. Don’t go more often than that, as each run uses some of your account’s resources. See what are resource limits.
Check it’s working
- Leave the cron job in place for half an hour.
- Schedule a test post a few minutes ahead, then wait for the next run.
- Check the post has gone from Scheduled to Published in Posts.
A free plugin such as WP Crontrol lists every scheduled event and when it last ran, which makes checking easier.
If it doesn’t work
- Scheduled posts still say “Missed schedule”. Check the path in the command. Open File Manager and confirm
wp-cron.phpsits in the folder you typed. - You want to see errors. Add your email address at the top of the Cron Jobs page and remove
>/dev/null 2>&1from the end of the command. You’ll get an email with any output after each run. Put it back once fixed, or your inbox will fill up. - The wget version fails. Your site may block the request, for example with a security plugin, password protection on the folder, or a firewall at Cloudflare. Switch to the PHP command instead.
- The PHP version is wrong. The cron command uses the server’s PHP. If your site needs a specific version, see how to change your PHP version.
- You want to undo it. Delete the cron job and remove the
DISABLE_WP_CRONline fromwp-config.php.
Still stuck? Open a support ticket and we’ll help.
WP Toolkit, staging, backups every six hours and free migration of your site.