We're rebranding and relaunching this site in November!

Learn more

How To Disable WP-Cron in WordPress And Enable It Server Side In Your Web Host

Last Updated on February 4, 2021 by Fabrizio Van Marciano

In this tutorial, I'm going to show you how to easily disable 'wp-cron' from running on your WordPress blog or website, and enable it on your server-side.

The web host provider I'm currently using is SiteGround; however, it doesn't really matter which host you use; this tutorial should more or less work the same for all other hosts. At least the ones that offer a CPanel or give you access to the File Manager.

Why should you disable wp-cron in WordPress?

Before I get into this tutorial, let me first share with you the 'one single reason', why I think you might want to disable the wp-cron from running in the background of your WordPress site.

  1. wp-cron throttle's CPU usage like nobody's business.

Yep, that's right, amongst other things of course.

You might not notice it immediately, but because wp-cron runs on more occasions than most people would want it to, it can create some real problems and actually increase server load time, which of course, isn't good for anybody's business, right?

How can you see the number of wp-cron script executions on your website?

If you log into your cPanel in your SiteGround hosting account, then scroll down the page until you see the CPU Time Usage.

If you click on the detailed stats link, then navigate to switch to 'view CPU Usage graph,' you'll see that somewhere /wp-cron.php will have quite a high number of executions. See the image below for an example.

CronA

Note: Since many web hosts have now updated their client UI, you may not always be able to access or view the CPU usage graph. The screenshots above were taken from the old Siteground UI.

Now let's understand something fundamental here. Cron jobs are important to have in WordPress, especially for scheduling tasks, blog posts, etc. You can't really completely disable it or have it not run at all.

That being said, you really don't need to have it running in the background that often, using up valuable hosting resources. And, it doesn't matter how many visits you get or don't get to your site either, wp-cron will still use up your resources more often than it should.

OK, so first here's how to disable wp-cron inside of your WordPress install.

(Disclaimer): Always backup your WordPress site and make copies of any page or file that you're going to make changes to. I usually use good old copy-and-paste for the files I'm going to change in my WordPress install. Save a copy somewhere on your desktop should you need to revert to it. I will not be held responsible if your site crashes due to you following the steps below.

So here goes.

Step One: Disable wp-cron in WordPress

Log into your SiteGround hosting account and navigate to the 'Websites' tab.

Reminder: If you're using a different web host provider such as Bluehost or HostGator, this tutorial should more or less be the same for those, too, as long as you can access the File Manager.

Click on the website you would like to access the File Manager folder. See the image below.

How To Disable WP-Cron in WordPress and Enable It Server Side!

Next, click on the Site tab to access the File Manager option. Navigate to the pubic_html file, click on the file name to open up the file. See the image below.

In the list of files under the public_html file, you will need to find the wp-config file. See the image below.

Make sure to click on the file name once to highlight it, then navigate back to the top of the File Manager menu options and click on the Edit option. See the image below.

You should now be able to see the contents of your wp-config file. See the image below.

Alert: Remember what I said at the beginning of this first step, always backup and make copies of anything you're going to make changes to. I would recommend selecting all the content in the wp-config.php file, then copy and paste it inside a blank notepad to save it on your desktop, just in case you need to revert. If you don't have a backup plan for your WordPress blog, click here to get some.

Right, so once you've backed up your wp-config.php file, scroll all the way down to the bottom of the original wp-config file inside your public_html subfolder, and in a brand new line, right at the bottom of the page, add the following code.

/* Eliminate nasty background wp-cron */
define('DISABLE_WP_CRON', 'true');

Do not modify the code, paste it exactly how it appears above. See the image below.

Once you've added this code, simply hit the Save button located at the top of the File Manager Menu, then click back on Explorer.

You've instantly stopped wp-cron from running in the background! That's the first step, let's move on.

Step Two: How to enable wp-cron inside your server in SiteGround cPanel

Now we're going to enable 'Cron Jobs' to execute on your server-side for your website, so that's the server in your SiteGround hosting or whatever host you're currently using.

We're going to set this to take place twice-per-day, instead of multiple times per day. Of course, you can set 'Cron Jobs' to execute more than that depending on your needs, but ideally, I'd recommend most bloggers have this set to no more than around 4 times per day. Unless, of course, you run a multi-author blog, where blog posts are being scheduled more often.

Let's get to it.

Log into your Siteground hosting account and navigate to the 'Websites' tab in the main menu.

Reminder: if you're using a different web host provider such as Bluehost, this tutorial should work as long as you can access the cPanel. Many hosting companies have updated their client user interface, and in some cases, the Cpanel may no longer be available.

On the 'Websites' management page in Siteground, click on the website you would like to access 'Cron Jobs' by clicking on the 'Site Tools' button located on the right-hand side. See the image below.

Next, you will see a page with lots of options for your website. In the left-hand options column, find the DEVS tab and click on it. A drop-down menu will appear, and you will see an option called 'Cron Jobs.' Simply click on this option. The next page you will see is the 'Cron Jobs.' See the image below.

Here you can create a new Cron Job. In the Command field, simply enter the following path.

cd /home/hostingusername/public_html; php -q wp-cron.php

Important: Don't forget to replace the 'hostingusername' part with your own SiteGround cPanel username, which you can find by navigating over your profile icon at the top of the navbar and selecting 'Login and Profile.'

In the 'Interval' field, select the 'Twice Per Day' option. You can leave the 'Minute Hour...' field empty if you wish.

Once you're done with this part, simply click Add New Cron Job. And that's it! You are done and dusted, my good friend.

You've now taken one smart step closer to reducing CPU usage and throttling and place less stress on your server. This little trick has worked wonders for me, and I do hope it works for you too.

Final quick notes

If you have more than one WordPress install on your hosting account with SiteGround, you'll have to do this for each of your websites. Don't forget to keep an eye on your CPU usage graph to ensure that what you've done is working for you.

Once again, this little tutorial is for anyone using WordPress hosted on SiteGround.

If you have any questions or comments, please feel free to send me an email here.

Thanks for reading, more tutorial posts coming soon.

Join Over 24,500+ Subscribers

Get fresh content from Magnet4Blogging delivered straight to your inbox, spam free! Or follow us on social media.
pencilcamera-videomic linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram