How to Disable WP-Cron For Faster Performance

Do you know, Disabling WP-Cron can make your website load much faster than before? It can also help you solve many WordPress timeout errors. Let’s explore How to Disable WP-Cron for faster performance in this article

This blog was hosted in Siteground. Off late I started getting 503 errors very frequently. A quick googling helped me discover that it could be because of a timeout error.

Contacted the Siteground support team and they responded within just 15 minutes saying that the wp-cron is causing the issue.

The Wp-cron.php takes more time to execute and that’s why I was 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 around 70% which was alarming.

So I went ahead and decided to disable the WP-Cron job. So here in this article, I am going to explain How to disable WP-Cron for better performance.

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, taking backups automatically, or any kind 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 an 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 prices and update the same manually.

In WordPress, cron jobs are handled 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 the 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 can trigger 503 Errors
  • Hampers website speed
  • Poor visitor experience
  • Bump in bounce rate and conversion
  • Poor SERP ranking

How WP-Cron Affects The WordPress Performance?

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 the website’s performance.

On the flip side, even though you have fewer plugins, those few plugins can also trigger the script continuously which will in turn slow down the website. So it is a must to disable WP -Cron for faster performance.

Do you know that WP-Cron can slow down your website even if you have very less traffic? We will explain how WP-Cron can affect performance in the following scenarios.

Websites Getting Very Huge Traffic

If a website gets 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

Websites Getting Very Less Traffic

You must be wondering how the hell it can affect website performance which gets very less traffic. It’s unfortunate but a true fact. A new website with a very little amount of traffics 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 slowly. 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 a system cron too. 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 a certain amount of time irrespective of whether it is getting triggered by WordPress or not.

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 the below piece of code 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 the page load.

define('DISABLE_WP_CRON', true);

Using A WordPress Plugin

If you are not comfortable with adding codes then you can try the 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 are executed. So, in other words, you will get full control of the WordPress Cron job using this plugin.

Disable WP-Cron

How To Create System Cron

A dedicated command is available in almost all web hosting 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 using the C Panel.

How To Add Cron Jobs In The C Panel

For most of us who use shared hosting, C Panel comes by default to control our web space. The C panel has a dedicated option to create Cron jobs.

  • Log In to the “C Panel” dashboard
  • Go to the”Advanced ” section
  • Click on ” Cron Jobs
  • Enter all information required
  • Under “Common settings “, select “Twice per hour“. [ You can choose the interval you want]
  • Click “Next
  • Enter the corn job code. If you are not sure, ask your web host.
wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1 [ This is just a sample ]
Disable WP-Cron
Disable WP-Cron

Conclusion: How To Disable WordPress Cron

Speeding up WordPress is a must. Unless your website is optimized it’s very hard to rank it. Every possible option should be executed to make a website fast. A cron job is one of the major concerns 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 faster than before.

If you have any concerns or facing issues in disabling or creating a Cron job please write in the comment section and I will be happy to assist.

FAQ: Disable WP-Cron

What Is WordPress Cron?

WordPress Cron or WP-Cron is an automation feature in WordPress that automates different tasks when page loads and is served to visitors.

Plugins and themes can use WP-Cron to automate different tasks at different intervals.

How Do I Disable Cron In WordPress?

You can disable cron in WordPress by adding the following piece of code in the wp-config.php file located in the WordPress root directory.

define(‘DISABLE_WP_CRON’, true);

Should I disable WordPress Cron?

If you care for your website speed, then you should disable WordPress cron and instead use system cron. Both do the same job but a system cron does not affect your website performance and does not count on your CPU utilization.

Rajib
Rajib

Rajib Is The Founder Of RiansTech. A Seasonal Blogger And A Full-Time Product Designer For Over Two Decades. A Technology Freak And Loves To Write About It. RiansTech Is A Online Home For Him Where He Documents His Experiences And Learnings So That Others Can Get Benefited From It.

RiansTech
Logo