Do you know, Disabling WP-Cron can make your website load much faster. It can also help to solve many WordPress timeout errors. Let’s explore How to disable WP-Cron for faster performance.
This blog is hosted in Siteground. Off late I started getting 503 error very frequently. A quick googling helped me discover that it could be because of a timeout error.
Contacted Siteground support team and they responded within just 15 minutes saying that the wp-cron is causing the issue. The Wp-cron.php taking more time to execute and that’s why I am getting a timeout issue which in turn shows the 503 error.
The error was giving me a lot of headaches and the bounce rate was hovering at 70% which is alarming. So I went ahead and decided to disable the WP Cron job. So in this article, I am going to explain how to disable WP-Cron for better performance.
- What Is WP-Cron
- Why do we need to disable WP-Cron
- How to disable WP-Cron for faster performance
- WordPress Cron Vs System Cron
- How To Disable WP-Cron
- How To Create System Cron
- Conclusion: How To Disable WordPress Cron
What Is WP-Cron
Cron Jobs are scheduled tasks that WordPress does at scheduled intervals. This includes publishing posts on a scheduled date, checking for updates, take backup automatically, or any set of automated work. Basically, Cron Jobs makes our life easy by automating the whole process. That’s really fun. Right?
If you are running an affiliate website like Amazon affiliates store, then cron jobs are a must. Cron jobs make sure that the price of all products are synchronized and updated whenever there is a change in the Amazon website. It’s next to impossible to search price and update the same manually.
In WordPress, cron jobs are handles by WP-Cron which is a PHP file named wp-cron.php. Every time whenever there is an update, the PHP file will run a script to update website data at the front end. Now, this wp-cron.php may be getting used by many plugins and this file has to run the script numerous times. So a useful automation feature can become a burden if it is not handled carefully.
Why do we need to disable WP-Cron
- Excessive Use Of WP Cron Triggers 503 Errors
- The website becomes super Slow
- Poor visitor experience
- Bump in bounce rate and conversion
- Poor SERP ranking
How to disable WP-Cron for faster performance
Since nowadays many plugins are dependent on WP-Cron to update content on your website, there is a high chance that at times WP-Cron will be overloaded. When multiple plugins are trying to access a single file, it does affect website performance. On the flip side, even though you have fewer plugins, but those few plugins can trigger the script continuously which will slow down the website. This is an ideal case with almost all Woo commerce affiliate stores.
Do you know that WP-Cron can slow down your website even if you have very little traffic? We will explain how WP-Cron can affect performance in the following scenarios.
- Websites having huge traffic
- Websites having very less traffic
Websites having very huge traffic
If a website has a huge number of visitors, the WP-Cron will be always busy running the script as it has to do multiple tasks at the back end. Sometimes due to overload, it will wait for PHP workers, as they might be busy with other jobs. Once a PHP worker is free, they will run the Wp-cron. Till that time you will have to wait and your website also will wait to load
Website Having very less traffic
You must be wondering how the hell it can affect the website performance with very little traffic. It’s unfortunate but a true fact. A new website with very little traffic also can be badly affected by WP-Cron. Basically, a Cron job only runs when the page loads. If there is very little traffic to a website, frequent page loading won’t happen, and as a result, Cron schedules will be missed. That’s the reason, if you open a website after some period of time, you will notice that it loads very slow. One reason is the pending cache buildup and the other reason is the pending cron jobs.
WordPress Cron Vs System Cron
Do you know that WP-Cron is not a real cron. It was created by WordPress to mimic the system cron. WordPress does not have confidence that System cron will run as and when it is required. So they created their own cron to do the job. But all jobs that a WP-cron does, can be done by system cron also. The benefit is that we can control the system cron. Ideally, for better performance, we need to disable WP-Cron and run the system cron periodically. So system cron will update the website after every certain amount of time irrespective of getting triggered by any plugins.
How To Disable WP-Cron
Disabling WP-Cron is very easy and straightforward. This can be done using any of the following methods.
- Adding a piece of code
- Using a WordPress plugin
Adding a piece of code
To disable WP-Cron you need to open the WP-config.php file located in the WordPress root directory. And then add below piece of codes just before the line that says “ That’s All, Stop editing! Happy Blogging.” Once you save the file it will disable WP-Cron from running on page load. However, in the case of force called it will run. But that’s only when you want to debug any issue.
Using A WordPress plugin
If you are not comfortable in adding codes then you can try WP Control plugin to disable default WordPress Cron jobs. You can edit, delete or add Cron jobs using this plugin. You can also control how frequently cron jobs to be executed. So, in other words, you will get full control of the WordPress Cron job using this plugin.
How To Create System Cron
A dedicated command is available in almost all web host control panels to add system Cron jobs. You can also use a command-line interface to add Cron jobs but that’s not an easy job if you are not a technical guy. Hence that process is not discussed here.
We will discuss adding Cron jobs through these popular web hosting control panels.
- Using the C Panel
- Using Plesk control panel
- using Siteground control panel
How to add Cron jobs in C Panel
For most of us who use shared hosting, C Panel comes by default to control our webspace. C panel has a dedicated option to create Cron jobs.
- Log In to “C Panel” dashboard
- Go to the”Advanced ” section
- Click on ” Cron Jobs“
- Enter all information required
- Under “Common settings “, select “Twice per hour“.
- Click “Next“
- Enter the following piece of code under “Command” section
wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
How to add Cron jobs in Plesk
- Log In to Plesk control panel
- Go to “Tools & Setting” and select “Scheduled task” under “Tools & resources“
- Go to Add task
- Enter same code like C panel and add schedule as “Hourly“
How to add Cron job in Siteground
Recently Siteground has started providing their own control panel but it’s easy to create a Cron job in the Siteground panel also. Please follow the below steps to create a Cron job in the Siteground control panel
- Log in to “Siteground Dashboard“
- Go to “Website” and choose the website
- Select “Site tools”
- Go to the”Devs” section
- Select “Cron Jobs”
- Enter the code and interval as shown in the picture
Conclusion: How To Disable WordPress Cron
Speeding up WordPress is a market need. Unless your website is optimized it’s very hard to rank it. Every possible option should be executed to make a website faster. Cron job is one of the major concern for many WordPress blogs.
I hope this article will help you to get rid of default WordPress Cron jobs and add a system Cron. For sure this is going to make your website but faster.
If you have any concerns or facing issues in disabling or creating a Cron job please do write in the comment section and I will be happy to assist.