Resources     Blog  

  1. Home
  2. WordPress Tutorials
  3. How to Disable Cron for WordPress and Improve Performance

How to Disable Cron for WordPress and Improve Performance

How to improve the performance of your WordPress website should be on the top of your list. Overall performance is important for the website for a number of reasons. You want the site running fast, and you need to have it properly optimized. One of the best ways to improve performance on a website is to disable cron.

What Are Cron Jobs in WordPress?

WP-Cron is how WordPress handles scheduling out time-based tasks. A number of very important core features in WordPress use WP-Cron. These will include but are not limited to:

  • Checking for Updates
  • Publishing Scheduled Posts
  • Backup Plugin Running on a Predefined Schedule

The “Cron” part of the name WP-Cron comes from the cron time-based task scheduling system that is available on UNIX systems.

Basically, WP-Cron works by checking, on every page load, a list of scheduled tasks. This way it can see what needs to run. Any tasks due to run will be called during that page load.

Note: WP-Cron does not run as constantly as the system cron does. It is only triggered on page load.

Why Use WP-Cron?

Even though WP-Cron PHP can have an effect on the overall performance of your website, there are still several good reasons to use it. Honestly, unless your website deals with very high traffic, you probably don’t need to worry about how often the system runs.

That being said, you do have the ability to disable cron in WordPress whenever you want. Before I show you how to do that, let’s look at some good reasons to use WP-Cron.

  • The WordPress core and many plugins need a scheduling system to perform time-based tasks. Cron jobs get this done.
  • Using the WordPress API is a much easier way to set scheduled tasks than going outside of WordPress to the system scheduler.
  • With WP-Cron, all scheduled tasks are put into a queue and will run at the next opportunity. The next opportunity really means at the next page load.

Note: There is no way to be 100% sure when the task will actually run. However, you can be 100% sure that it will indeed run.

Why Does WP-Cron Cause Performance Issues?

WP-Cron is the built-in cron handler for WordPress. Many high traffic and high demand and interaction websites may find they have issues with this. See, WP-Cron is not a real cron job. Instead, it is the system WordPress has created to mimic what a system cron does.

And while sites with high traffic can have issues, sites with very little traffic can suffer performance issues as well. This is because when not many people are loading a page, then a schedule has a higher chance of being missed.

A solution to this is to disable cron and then use the system cron instead. This will help you better run a predefined schedule.

With that being said, let’s take a look at how to easily pull off a WP-Cron disable method. I will also show you how to create a cron job using cPanel after WP-Cron has been disabled.

How to Disable WP-Cron

In order to disable WP-Cron, you need to access the wp-config file for your website. To do this, log into cPanel and click on the “File Manager”icon.

Click file manager icon

Once inside the file manager, click on the “public_html folder” and then search and open the wp-config file.

Click pblic html folder then wp config file

Go ahead and open the wp-config file and add this line into it:

define</span><span class="s4">(</span><span class="s1">'DISABLE_WP_CRON'</span><span class="s4">,</span> <span class="s5">true</span><span class="s4">);

You want to add this down at the bottom of the file around line 68. Right before the end of the file. See where I added it in the following screenshot.

Add code to disable cron

Once this is added, go ahead and save the file and you are good to go. At this point, WP-Cron has been disabled.

You can choose to just move on from here, as we have disable cron in order to improve performance. However, it is still a good idea to create cron jobs and make sure certain tasks are being handled.

You can create your own channel and have total control. Let’s take a look at how together.

Note: Make sure you disable the default WP-Cron first, as we did together above.

Create a Cron Job in cPanel

In order to create your own cron job, you will need to log back into your cPanel. If you are still in there because you just accessed the wp-config file, great.

Scroll down to the “Advanced” section of your cPanel and click on the “Cron Jobs” icon.

Click on cron jobs icon

You will see there is an “Add New Cron Job” page now. Go ahead and add in the settings you want under the Common Settings area. There are several predefined schedules to choose from. These will include options like twice per day, once per week, and many more.

Adding cron jobs

Simply choose the one you want and the box will auto fill.

Finally, you need to add the following line of code into the command line:

wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

You want to replace the https://domain.com portion with your domain. So don’t forget that.

You can see it done here in the screenshot as well.

Command line for cron job

Note: This command could vary slightly based on how your hosting is configured.

Now click on the “Add New Cron Job” button and you are good to go.

That’s it! You have successfully added your own cron job using cPanel.

Easy Cron

Disable cron using easy cron

Lastly, if you are not comfortable with creating your own cron jobs in cPanel, or if your web host does not provide you with that access, then you have another option. You can use a solid third-party solution like Easy Cron.

This solution is a great alternative to what we did above. They will give you all the tools necessary to perform all the cron functions you need. Give them a look if you are not comfortable with what we went over together above. 

It is basically allowing you to perform all the same functions, but giving you an easier way than to make the changes yourself.

Final Thoughts

There is a lot to think about if you want to disable cron in WordPress. Yes, your site may run smoother, but you still need it to perform certain functions. For this reason, it is a good idea to create your own cron jobs in cPanel or by using a third-party solution.

I showed you how to not only disable cron, but also how to create your own cron jobs using cPanel. Furthermore, if you are not comfortable with that, then you can check out the suggested Easy Cron solution.

I hope this tutorial has shown you how easy it is to disable cron in WordPress in order to improve performance. You may need to do some research or go slowly through the process if it is your first time, but you will get there.

Not everything in WordPress can be handled with a plugin. While this method is definitely preferred, in some instances you need to have knowledge of your website files, how to access them, and how to configure certain options.

Have you disabled cron on your WordPress site before? Have you found that there is a link to that and better overall performance?

Author: Jeremy Holcombe

Growing up in Hawaii, Jeremy started his freelance writing career doing resumes, business plans, article writing, and everything in between. He now specializes in online marketing and content writing and is part of the Content Marketing Team at GreenGeeks.

Was this article helpful?

Related Articles

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.