Do you ever schedule blog posts to go live at a specific time, or rely on automatic backups and updates to keep your WordPress website running smoothly? If so, you’re already using a behind-the-scenes tool called WP Cron.
It might sound technical, but at its heart, WP Cron is simply a scheduler that tells your website to perform certain tasks automatically at set times or intervals.
Disabling the default WP Cron and setting up a system cron instead is recommended. This article will explore all this further.
Examples of what WP-Cron does for your website
WP-cron does some important tasks in the background of a WordPress website
- Publishing scheduled blog posts.
- Checking for WordPress updates.
- Running backup plugins on a schedule.
- Sending out automated emails.
Some WP-cron limitations and their effects
While WP-Cron is convenient, it has a key limitation: it usually only runs when someone visits your website. This can cause the following issues for your website
- For websites with low traffic, this can be a problem because scheduled tasks might not run on time if no one visits the site. For example, a scheduled post might not get published if there are no visitors to trigger the process.
- For websites with high traffic, WP-Cron might run too frequently, which can sometimes slow down your website’s performance. This is because every page load might trigger a check for scheduled tasks.
How to overcome the limitations of WP-cron
For scheduled tasks to run reliably and not impact your website’s speed or function, disabling the default WP Cron and setting up a system cron job is recommended.
A system cron job is managed by your web hosting server and runs on a precise schedule, independent of website visits. This is often recommended, especially for busy websites. There are several methods to set up system cron jobs and they vary in complexity
setting up a system cron for your website
Various methods are available for setting up system cron jobs for your WordPress website:
- cPanel cron jobs – look for the Cron Job app in the cpanel tools section. WP-cron will still need to be disabled via the WP-config.php. Cpanel also now allows you to disable WP-cron and set up new cron jobs from the install screen.
- WP CLI, particularly relevant for multisite setups, and, for those using Cloudways hosting
- Cloudways – if you are using Cloudways hosting you can use Cloudways platform’s tools to set up system cron jobs.
- WP-crontrol (WordPress plugin) – this plugin has the functionality and interface to allow set up and control of system cron jobs. While this option allows the greatest level of control and functionality, it represents one of the more complex methods of managing these tasks
If you are a Kinsta customer, their server-side cron triggers wp-cron.php every 15 minutes by default. This would be useful for low traffic sites. High traffic sites may need further assistance with cron.
A simpleR method FOR managing system cron
Cpanel offers a simpler method of disabling the default WP Cron and setting up a system cron. Its explained in the following:
- Disable WP-Cron:
During the install process of WordPress, cpanel offers the option to toggle the disable of WP-cron which most website managers would find helpful.
Failing the ability to toggle the disabling of WP-cron, you’ll need to edit a core WordPress file called wp-config.php. This file contains important settings for your website. You can usually access it using an FTP client or the file manager in your web hosting control panel.
Before making any changes, it’s a good idea to create a backup of the wp-config.php file, just in case something goes wrong.
Open the wp-config.php file and add the following line of code just before the line that says /* That’s all, stop editing! Happy blogging. */:
define(‘DISABLE_WP_CRON’, true);
Save the changes and upload the file back to your website. This will stop WP-Cron from running on every page load. Note that this only disables it from running automatically when someone visits your site, not if you try to run it directly.
- Set Up a System Cron Job:
Now that you’ve disabled the default WP-Cron, you need to tell your server to run the WordPress cron at regular intervals. The exact way to do this depends on your web hosting provider. Many hosting providers use a control panel like cPanel, which has a tool for managing cron jobs.
Here’s how you can typically set up a system cron job in cPanel:
Log in to your cPanel account.
Look for an “Advanced” section and click on “Cron Jobs”.
You’ll be asked to set a schedule for the cron job. You can choose from predefined options or set a custom schedule. A common setting is to run the cron job every 30 minutes or twice per hour. Your hosting provider might have limits on how often cron jobs can run. Some hosts like Kinsta run it every 15 minutes by default for single sites. WPBeginner recommends 30-minute intervals. WP Hosting suggests every 5 minutes, which you can adjust as needed.
In the “Command” field, you need to enter a command that tells your server to run the WordPress cron script. Use the following command, making sure to replace https://domain.com with your actual website address:
wget -q -O – https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
The >/dev/null 2>&1 part at the end prevents email notifications from the cron job.
Click “Add New Cron Job” to save your settings.
Now, your server will run the WordPress cron script at the interval you specified, ensuring that your scheduled tasks are executed reliably.
If your hosting provider doesn’t use cPanel or doesn’t allow you to set up cron jobs, you can also use third-party cron services like EasyCron, cron-job.org, or Cronitor.
These services provide a web interface to schedule cron jobs by providing your website’s WP-Cron URL.
Monitoring your website cron
Finally, I should also add that I personally like to monitor the functioning of the cron, especially after a period where the function of the cron has caused trouble with a website.
I like to use a simple plugin wp-cron-status-checker as this provides a simple dashboard feedback about the current cron status. I find it handy also to monitor sites for awhile when I’m contemplating customizing the crom to optimise the site.
Conclusion – Disabling the default WP Cron and setting up a system cron
By disabling the default WP-Cron and setting up a proper system cron job, you can improve your website’s performance, especially for high-traffic sites, and ensure that your scheduled tasks run consistently on low traffic sites.
Various methods are available for setting up system cron jobs for your WordPress website while cPanel offers a more simple method. There may be benefits to your website in disabling the default WP Cron and setting up a system cron.
Hi, Im Gary. Based in NE Vict, I operate a small agency providing personalised website services across Australia (New Sites, Repairs and SEO). Learn more About Me or visit my Contact Page. I hope you find these articles useful. Email me if you have any questions.