
Many WordPress sites use the built-in scheduler WP-Cron by default. Handy on paper, but in practice this can cause slow load times or just missed tasks. Think of a blog post not going live on time, or a backup not running. Fortunately, you can easily fix this by disabling WP-Cron and replacing it with a real server-cron.
What is WP-Cron and why can it cause problems?
WordPress has a built-in task scheduler called WP-Cron. Which ensures that scheduled tasks are performed automatically, such as:
- publishing a scheduled blog post
- checking for updates to plugins or themes
- Running backups or maintenance tasks
The difference with a "real" cron (like at the server level) is that WP-Cron does not run continuously. It is activated only as soon as someone visits a page of your website.
That sounds convenient, but can cause two problems:
- Little traffic? Then WP-Cron is not called often and scheduled tasks run late or not at all.
- A lot of traffic? Then WP-Cron has to check every page load to see if anything needs to be done, which can slow down your site unnecessarily.
For small sites with few scheduled tasks, the default is often fine. But once your site gets bigger or you want to make sure tasks always run on time, it's smarter to set up WP-Cron in a different way.
How do you disable WP-Cron and set up a system-cron?
By default, WordPress uses WP-Cron to handle scheduled tasks. The downside is that this happens only when someone visits your site. On small sites, this means that tasks sometimes run late, while on busy sites each page load causes extra server work.
The solution is to disable WP-Cron on page load and run the tasks through a system-cron to run. A system cron is your server's task scheduler. It runs at fixed times that you set, independent of your visitors. This ensures that tasks always run on time and that your site responds faster.
Below you will read step by step how to set it up.
1. Disable WP-Cron in wp-config.php
The first step is to adjust your wp-config.php
. This file is in the root folder of your WordPress installation. You can find it via:
- SFTP or file management in your hosting panel → go to the folder where WordPress is installed (often
public_html
or the domain folder). - In that folder you will see files such as
wp-config.php
,wp-login.php
and the folderswp-content
,wp-admin
,wp-includes
.
Open wp-config.php
with a text editor. Insert the following line just above the text "That's all, stop editing! Happy blogging.":
define('DISABLE_WP_CRON', true);
From this point on, WP-Cron will no longer run on every page visit. You will soon be able to run the process via a cron job at set times, eliminating the extra load on your pages.
Need rollback?
If you want to reset it to the default, delete this line or put in //
for. WordPress then automatically re-enables WP-Cron.
2. Schedule a cron job
Now that you have turned off WP-Cron in wp-config.php
, there must be a replacement come to take over the work. That is a cron-job.
You can think of a cron job as a alarm clock for your server: you agree to wake him up at set times to check if something needs to be done. For example: every 5 or 15 minutes. That way you can be sure that scheduled tasks such as newsletters, backups or blog posts always run on time, without depending on visitors to your site.
Which method you use to set up that cron job depends on your hosting package:
Have you An extended package or VPS with SSH access (often with managed or professional hosting)? → use CLI. This works more reliably because you are calling WP-Cron directly through the server, with no detours.
Have you a standard hosting package without technical access to the server (usually with cheaper or shared hosting)? → use HTTP. That simply means that the server itself calls your site URL to activate WP-Cron.
Option A: HTTP (default in cPanel, suitable for almost everyone)
The most accessible way is via an HTTP call. In this, the server automatically visits the wp-cron.php
-page of your site.
This is how you set this up in Surver:
- Log in to your cPanel.
- Search under the heading Advanced to Cron Jobs.
- Click on Add New Cron Job.
- Set the interval, for example every 5 minutes (The "Common Settings" drop-down menu allows you to select this quickly).
- Fill in at Command the following in (replace
yourdomain.com
by your own domain):
wget -q -O - "https://jouwdomein.nl/wp-cron.php?doing_wp_cron" >/dev/null 2>&1
Click on Add New Cron Job. From then on, your server runs the WP Cron every few minutes, even when there are no visitors.
Option B: WP-CLI (advanced, via SSH)
Do you have a package with SSH access and if you want maximum reliability, you can also set up the cron via WP-CLI. This goes outside HTTP and is less sensitive to caching or firewalls.
- Log via SSH in on your server (Surver can help you enable this).
- Open the cron tab with:
crontab -e
- Add a task, for example:
With PHP:
*/5 * * * * * * * cd /home/username/public_html && php -q wp-cron.php >/dev/null 2>&1
With WP-CLI:
*/5 * * * * * * * cd /home/username/public_html && wp cron event run --due-now >/dev/null 2>&1
- Save and exit. The cron job is now active.
Opinion: for most customers is Option A via cPanel more than enough. Only if you work with large web shops or heavy automations can Option B via WP-CLI provide more stability.
3. Choose the right interval
A cron job should run often enough to handle all tasks in a timely manner, but also not so often as to unnecessarily load the server. For most WordPress sites, an interval of every 5 to 15 minutes fine.
- 5 minutes: suitable for sites with many scheduled tasks, such as large web shops or sites with a lot of automation.
- 15 minutes: sufficient for blogs, business sites and smaller web shops.
- Shorter than 5 minutes: needed only for very specific use cases (e.g. critical API syncs).
Many managed hosting parties default to 15 minutes. Adjust this only if you notice that tasks are falling behind.
4. Checking that everything is running
Once you have set up a cron job, it is important to check that WP-Cron is actually running properly. You can do that with a few simple commands via WP-CLI.
- Test the spawner:
wp cron test
If you get the message "WP-Cron spawning is working as expected", you know the basics are right.
- View scheduled events:
wp cron event list
Pay particular attention to the columns Next Run and Recurrence to see when the next task is scheduled.
- Turn off overdue tasks immediately:
wp cron event run --due-now
Useful for checking that all processes are working cleanly or to clear backlogs immediately.
With these three checks, you can quickly see if your cron is set up properly and if your scheduled tasks are actually running.
Troubleshooting for problems
Is your cron job not working as expected? Here are the most common causes and solutions:
- Tasks run late or not
First, check that the cron job is really running. For HTTP cron, you can look in the server logs to see ifwp-cron.php
is called. WP-CLI allows you to force backlogged tasks with:wp cron event run --due-now
- HTTP cron does not work
Often caching, a firewall or Basic Auth blocks the call. Then try the CLI method, which bypasses such layers. - You see
?doing_wp_cron
in URLs
This is a normal side effect of HTTP triggers. If you don't want this, choose the CLI variant. - Multisite or managed hosting
Some hosting parties already have server-cron set up. Disable WP-Cron only if you are sure an alternative is active. - Security considerations
Latewp-cron.php
not unlimited public access. With CLI and WP-CLI, you limit the attack surface and have more control.
With these checks, you'll solve most problems right away. If things keep going wrong, it is wise to consult with your hosting party - often they already offer a standard solution.
Checklist & best practices
Finally, the short summary to set up your WP-Cron securely and reliably:
- Turn off WP-Cron in
wp-config.php
withdefine('DISABLE_WP_CRON', true);
- Schedule a system cron, preferably via CLI or WP-CLI.
- Use an interval of 5 to 15 minutes, depending on your site.
- Check the operation with
wp cron test
andwp cron event list
. - Solve overdue tasks with
wp cron event run --due-now
. - Avoid HTTP triggers like caching, firewalls or Basic Auth throwing a spanner in the works.
By disabling WP-Cron and using a real cron job, scheduled tasks are always executed on time without slowing down your load times.
Would you rather have this type of optimization professionally set up? At Surver's WordPress optimization we make sure your site is technically tight and performing optimally, so you can focus on your business.