WordPress

Replace WP-Cron with a real cron job in cPanel

Make WordPress scheduled tasks reliable and lighter: disable visitor-triggered WP-Cron and run wp-cron.php from a cPanel cron job every few minutes.

IntermediatecPanel hosting3 min read

WordPress has no real scheduler. Instead, WP-Cron checks for due tasks on page loads. On quiet sites tasks run late or not at all (missed scheduled posts, delayed backups, stuck emails); on busy sites the check runs far more often than needed. A real cron job in cPanel fixes both problems.

Before you start

  • Access to cPanel and wp-config.php.
  • Know where WordPress is installed, for example /home/username/public_html. Your home directory is shown in cPanel's General Information panel.

Disable the built-in trigger

Edit wp-config.php in cPanel → Files → File Manager and add above the "stop editing" comment:

define( 'DISABLE_WP_CRON', true );

This only stops page loads from triggering cron. The tasks still run once the real cron job calls wp-cron.php.

Create the cron job

  1. Open cPanel → Advanced → Cron Jobs.
  2. Under Add New Cron Job choose Common Settings → Once Per Five Minutes, or every 15 minutes for small sites.
  3. In Command enter one of the commands below.
  4. Click Add New Cron Job.

Run it with PHP directly (recommended, no web request needed):

cd /home/username/public_html; /usr/local/bin/php wp-cron.php >/dev/null 2>&1

Or with WP-CLI, which only runs events that are due:

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

Replace username and the path with your own. For an addon domain use its document root instead of public_html.

Check that it works

  • Schedule a test post a few minutes ahead and check it publishes on time.
  • Install WP Crontrol temporarily and look at Tools → Cron Events; no events should be listed as overdue.
  • In Tools → Site Health the warning about scheduled events should be gone.

Choosing the interval

Site typeSuggested interval
Brochure site or blogEvery 15 minutes
Shop or membership siteEvery 5 minutes
Site sending queued email or newslettersEvery 1 to 5 minutes

Running more often than every minute does not help, and very frequent jobs on many sites add up against your CPU allowance.

Several WordPress sites

Each install needs its own cron job pointing to its own folder. Stagger them (for example minute */5, 1-59/5, 2-59/5) using the minute field so they do not all start at the same second.

Troubleshooting

  • Cron emails fill your inbox: add >/dev/null 2>&1 at the end, or clear the Cron Email field at the top of the Cron Jobs page.
  • "Could not open input file": the path is wrong. Check it in File Manager.
  • Tasks still late: a single long task blocks the queue. Look at overdue events in WP Crontrol and the plugin that owns them.
  • Wrong PHP version: /usr/local/bin/php uses the account default. Point to a specific version, such as /opt/alt/php83/usr/bin/php on CloudLinux, if needed.

Frequently asked questions

Can I call wp-cron.php over HTTP instead?

Yes, with wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1. It works, but it goes through the web server, can be blocked by security rules and is subject to web timeouts. Running PHP directly is more reliable.

Will scheduled posts still publish if the site has no visitors?

Yes. That is the main benefit: the cron job runs on time whether or not anyone visits the site.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.