WebGee DocsDocs
WordPress

Replace WP-Cron with a real cron job

WordPress runs scheduled tasks on page load, which slows busy sites and misses schedules on quiet ones. Move them to a system cron job instead.

Stop WordPress running its scheduled tasks on page load, and run them on a real schedule instead. Applies to shared, reseller and Premium hosting.

Why WP-Cron is a problem

WP-Cron is not a cron job. It is a workaround: WordPress checks for due tasks every time someone loads a page.

That fails in both directions:

  • On busy sites, every visitor may trigger the check. If PHP workers are saturated, a request arrives, WordPress starts the cron, and the cron waits for a worker — so the visitor waits too. This is a common contributor to 503 resource limit errors.
  • On quiet sites, scheduled tasks simply do not run, because nobody loaded a page. Scheduled posts miss their time and backups do not happen.

A real cron job fixes both: it runs on a fixed schedule regardless of traffic, and never blocks a visitor. WordPress's own plugin handbook recommends it.

1. Disable WP-Cron

Edit wp-config.php and add this above the line reading /* That's all, stop editing! */:

define( 'DISABLE_WP_CRON', true );

This stops the page-load trigger. It does not stop wp-cron.php running when called directly — which is exactly what the next step does.

2. Add a system cron job

  1. In cPanel, open Cron Jobs.

  2. Set the schedule to Once Per Five Minutes, or enter */5 * * * *.

  3. Enter the command:

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

Replace cpaneluser with your cPanel username, and adjust the path if WordPress is not in public_html.

Five minutes suits most sites. Going more frequent recreates the load problem you are solving; going less frequent delays scheduled posts. If you use WooCommerce, keep it at five — order processing and stock updates depend on it.

The > /dev/null 2>&1 suppresses output. Without it, cPanel emails you the result every five minutes — see Stop cron emails.

Check it worked

Install WP Crontrol and open Tools → Cron Events. Events should show as running on schedule, and the notice about WP-Cron being disabled confirms step 1 took effect.

You can also confirm directly:

cd /home/cpaneluser/public_html && php -q wp-cron.php && echo "ran ok"

If scheduled tasks stop running

  • The path is wrong. cPanel does not validate it. Run the command manually over SSH and see what it reports.
  • WordPress is in a subdirectory. Adjust the cd path accordingly.
  • DISABLE_WP_CRON was added below the "stop editing" line, where it has no effect. Move it above.

On this page