wp-cron is slowing the site down
WordPress runs scheduled tasks when someone visits the site. On busy sites the server should run them instead.
- You need
- FTP
- Updated
WP-Cron isn't a real cron job. On every page view, WordPress checks whether a scheduled task is due, and if so it starts wp-cron.php as a separate request to itself, at most once a minute. Such tasks include scheduled posts, automatic updates, backups from plugins and the WooCommerce queue.
Visitors don't wait for the tasks, but the tasks use the same PHP processes and the same database as visitors. Heavy tasks therefore make a busy site slower. On sites with little traffic, or where pages are served from the cache without starting WordPress, the problem is the opposite: tasks run late. In both cases it helps to let the server start the tasks at fixed times.
See what is scheduled
- Go to Tools → Site Health. If it says "A scheduled event is late" or "A scheduled event has failed", the tasks aren't running as they should.
- Posts marked "Missed schedule" in the post list weren't published because wp-cron didn't run in time.
- Install the WP Crontrol plugin. Under Tools → Cron Events you see every scheduled task, how often it runs and when it runs next. Look for tasks that run very often, and tasks from plugins you have deleted.
- If you use WooCommerce, you see the queue under WooCommerce → Status → Scheduled Actions. Many pending actions that should have run long ago mean the queue is falling behind.
If Site Health says "Your site could not complete a loopback request", WordPress can't send requests to itself, and WP-Cron never starts. Typical causes are password protection on the server (Basic Auth) or a firewall that blocks the server's own IP address. With WP-CLI, wp cron test checks the same thing.
Stop running tasks on page views
Open wp-config.php over FTP or in the file manager in your hosting panel, and add this line just above the line with require_once ABSPATH . 'wp-settings.php';:
define( 'DISABLE_WP_CRON', true );
WordPress no longer starts the tasks on page views. Only do this together with the next step. Without a cron job on the server, no scheduled tasks run at all.
Let the server run wp-cron
Go to the page for cron jobs or scheduled tasks in your hosting panel, and add a job that opens wp-cron.php at regular intervals:
wget --delete-after https://yourdomain.com/wp-cron.php
Replace the domain with your own. How often the job runs is up to you. Every five minutes (*/5 * * * *) is a common choice, and a task is then never more than about five minutes late.
If the server has WP-CLI, the job can instead run the tasks directly on the server, without a request over the web:
wp cron event run --due-now --path=/path/to/wordpress
Replace /path/to/wordpress with the WordPress installation folder. You can see it in the file manager in your hosting panel.
Check that it works
Wait until the job has run a few times, and open Tools → Cron Events again. The next run times should be in the future, not in the past. Also check that Site Health no longer shows late events.
When you're stuck
If the site is still slow after the server has taken over wp-cron, either the tasks themselves are heavy, or the slowness has a cause other than wp-cron. Find out which plugin is behind the heavy tasks, and whether they can run less often or at night. If your hosting panel has no page for cron jobs, you can ask your hosting provider to set up the job. Otherwise an external service such as cron-job.org can request wp-cron.php at fixed times.