Disable WordPress Cron Jobs WP-CRON.php

Instantly speed up your WordPress theme by tons and stop hosting throttling.
If you don’t care for the inner works and just want steps skip to the advanced users quick guide.
If this all scares you contact me and I’ll do it for only $10 USD via PayPal for each site.

I don’t know if it was an update to WordPress or what but my sites were crawling slow and I am pretty optimized and use very few plug-ins. I even use the highly rated Genesis Theme.
Ever since the WordPress update my sites have been acting up, I disabled all of my tracking, related post, social icons, etc. And they were still so slow.
In fact, my most popular content is on static html pages that load almost instantly even without caching plug-ins but those started failing on me to the point where Google warned me of a traffic change and time outs.
Here is a screen shot I took as I was fixing the problem. You only get the tail end of it, but it was like that all the time.
cpu throttling bluehost
After, what my CPU Throttling looks like all the time now.
fix cpu throttling

I decided to write this article to help you fix it. I saw a lot of misleading information on this out there that was not very clear, and most of it seemed to be trying to sell you commissioned hosting. I swear some of the authors are even >BlueHost, WP Engine, and GoDaddy themselves trying to trick you.

I called BlueHost and they didn’t know anything, or why my sites have come to a halt other than “plug-ins”. Very unhelpful, just like GoDaddy always has been.
I am very disappointed with BlueHost for having the technology to throttle me but not the technology to know why they are throttling me. Same as GoDaddy. WordPress recommends Blue Host as the very first hosting solution and they are pretty cheap but then they can’t host WordPress out of the box or help you with it? It sounds to me like they are not a WordPress hosting company.
I started doing research and hunting down the issue, or issues. There are several! All WordPress’s fault, not BlueHost. But if BlueHost is going to claim to be a WordPress hosting company they should be able to help with it.
Luckily I fixed the problem myself and I do like Bluehost other than that interaction with them. They have been able to help me on other issues.
Update: I left them, article coming soon. Subscribe.

Cron Job aka wp-cron.php

What is a cron job anyways?
A Cron Job is basically a scheduled task and the wp-cron.php file is a way to check that list of task and run them if their time has passed. But this file can not self execute so WordPress has to access it every single time someone visits your site to see if there is anything in the list that needs to be done. That can be demanding, especially when you start to get traffic across multiple web sites on one hosting account.
What task? Things like scheduled database backups, checking for plugin updates, clearing the cache, publishing a scheduled post and more. If you have a lot of these running rampant every 15 minutes or hour they start to stack on top of each other and bring your site down via throttling from your very unhelpful hosting provider.

So if by default it is triggered and accessed every single time someone visits your site(s) and we want to turn it off, how will it run?
Wordpress views the wp-cron.php and ask, “Hey, is there anything you want me to do right now?” So we don’t want to turn it off and forget about it.
So we will disable it in the WordPress Core and then set up a cron job on our hosting server. That job will tickle the wp-cron.php file via a wget command forcing the cron jobs that have passed to fire up. I set mine to once a day in the wee hours of the morning during a time it won’t bother anyone if it does slow my sites.

Disable wp-cron.php WordPress Cron Jobs

So we want to stop this insanity that runs every time someone visits our page. But how?
This is the easy part. You simply FTP(File Transfer Protocol) into your hosting account and locate the wp-config.php(not wp-cron.php) file in the root directory of your WordPress installation. Edit that file and place this code.

define('DISABLE_WP_CRON', true);

But where?!?! I just put it right after the first define which for me was define w3 total cache.
edit wp-config

You can verify that it is no longer running a muck by scheduling a post for 5 or more minutes into the future. Wait for that time to pass, see the new post was never published and then go look at all post to see it say missed schedule on it. This means no super auto cron was fired as they usually do and it will not auto post until you force a cron.
Depending on your scheduled backup plug-in you may notice something like this confirming you successfully disabled the wp-cron.php from running.
disable wp cron

Now that we are SURE the wp-cron is NOT running we can try to fire it our self and see if that post publishes.
Add your site to this url and put it in your browser.

http:// your web site .com/wp-cron.php?doing_wp_cron

That should have tickled the file, forced it to run the missed scheduled post and anything else it missed along the way. Go see if the post is up now.

Server Side Cron Jobs

Now that WordPress isn’t running your crons then who will? We can’t go posting that link in the browser all the time.
We can set up your hosting server to run it for you when you want, automatically. I personally only want it to run once a day in the wee hours of the morning. And because I have several sites I will stack them an hour apart to make sure the cpu process isn’t all hit at once like it currently is. The reason this is ok for me is because I only run backups. I do not schedule post or anything. I can see my Facebook comments tries to get every 15 minutes but I’m not too worried about that. All other jobs are more like once or twice a day. So why does WordPress ask my server every single page load? Insanity!

Anyways, log into your hosting cpanel(Control Panel) and look for Cron Jobs under advanced.
Here’s what it will look like on BlueHost and likely on GoDaddy too.
Note, if you do not have access to your servers cron jobs you can use an outside service such as Easy Crons.
cpanel cron jobs

Once you’re in there you’ll see this screen and you want to select a time such as once a day, twice a day, hourly, etc.
I was able to set once a day and then select say 4am for one site, 5am for another, 1am etc. So I staggered them an hour apart over night. Some of my Word Press sites I never update and I even put them on once a week or every 2 days. Here is what the BlueHost and maybe GoDaddy screen should look like.
add cron bluehost godaddy

wget -O /dev/null http://your site.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

So that’s it. This code will use the wget function from your server and reach out to your website’s wp-cron file, tickle it, wake it up and fire off any cron jobs WordPress has stored up waiting to go. That way the wp-cron runs when YOU want it to. Not every single time your site is hit by a human or a bot. It’s beautiful. And the good thing about this code is it will not leave a cronjob log file on the server. They can stack up fast if you don’t disable logging. Most sites out there tell you to do it the wrong way and I learned that if you don’t look at your servers root folder in as little as a month you can have thousands of log files smashed in there.

While researching this whole matter for myself I was surprised to find a few task in my WordPress Cron Jobs from plug-ins I have already deleted.
JetPack, that huge slow piece of garbage plug-in was one of them! And they KNOW that their crap plug-in leaves behind cron jobs using up your server process after you delete it and they only answer with this online.
jetpack slow sucks

Quick Guide! Disable Word Press Cron Jobs

For those who don’t care how it works / need an explanation.

1) FTP into hosting, edit wp-config.php place code under first define. define('DISABLE_WP_CRON', true);
2) Log into cpanel > Advanced > Cron Jobs > Add New > Use following string. wget -O /dev/null http://your-site.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

Note: If you do not have access to your hosting providers cron jobs you can use a free external service such as Easy Crons.
I myself actually use Easy Cron now because I set up about 8 crons and had them working for months via BlueHost but then they all randomly got erased. I called and they said they had no idea how and could not restore them. I could have fixed it but I don’t want to have to set them all up again. Ever. So I use Easy Cron and forget about it.

BPS Security iThemes Security Users

If you use BPS or the now iThemes WordPress Security Plugins then you will need to manually remove a line of code from your .htaccess file.
They have put in a line of code that blocks wget request and it will stop your cron from ever getting the request to run.
Simply remove this line.
RewriteCond %{HTTP_USER_AGENT} ^Wget [NC,OR]

You’re welcome and please comment below and subscribe.
Also I mentioned several problems. This is only one of them. If you want the upcoming series of hidden back end and front end tricks to speed up your WordPress be sure to subscribe.

14 thoughts on “Disable WordPress Cron Jobs WP-CRON.php”

  1. Rebecca Hatton

    Hi,

    I’ve been stuck with a problem for a while and I’m wondering if you could help seeing as this post is the same topic….

    Cpanel shows me i am getting input/output usage faults. I/O usage has a limit set of 1MB/s. I have minimum plugins installed. All other stats such as cpu usage etc are well within the limit.

    On the advice of the hosting provider I have done the following

    1) I have updated the wp-config file with define(‘DISABLE_WP_CRON’, true);
    2) I have set-up cron jobs using cpanel
    3) I have Heartbeat installed with a frequency set of 300 on all locations
    4) I have WP Control installed and I’ve edited cron events to be less frequent. Although in the settings it says: The DISABLE_WP_CRON constant is set to true. WP-Cron spawning is disabled.

    I did this stuff weeks ago but the i/o faults are still occurring, and the hosting advice is limited:
    “The reason for this is WordPress cron (wp-cron.php) and WordPress Heartbeat (admin-ajax.php). To fix it we suggest the following:
    – Please replace your WordPress cron with a real cronjob
    – Please install the following plugin WordPress Heartbeat”

    They have given me the same advice as they gave me weeks ago.

    I am getting round in circles, getting nowhere fast and very confused!

    Any help would be greatly appreciated. Thank you. PS I also have iThemes security installed

  2. Thanks for the well explained tip.I followed your advice and transferred all cron jobs to be server side executed.But actually WP-CRON jobs and server’s cronjobs load the same CPU so the only benefit is the timing aka scheduling the task in the least busy hours if you have installed like me Easy Update Manager.
    And BTW I do use iThemes security but I didn’t find such Rewrite condition regarding Wget in my htaccess file.

    1. Yes the timing benefit during non peak hours and the fact that WordPress was firing cron on every single visit to the site, which slows everything down.

  3. MakeOnlineShop

    Hello, people don’t really need cron, actually, except if you need any specific automatic task, you do not need cron at all. They are totally useless and just cause troubles. Thanks for your post.

  4. You are better off setting cron to run wp-cron locally seeing as the file is sitting on the computer which you are getting to run it. You are much less likely to have issues with it timing out on a slow server as a local job will have a higher timeout limit than a web request.

    Find the path to your wordpress install on your server and modify this to suit:

    0 * * * * cd /var/www/website/htdocs; php -q wp-cron.php >/dev/null 2>&1

  5. As I recall, the wp-cron file wants to see a POST request. Also, some servers block the WGET user agent. In this case, I propose the following improvement:

    wget –post-data=string –header=”Accept: text/html” –user-agent=”Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0″ -O /dev/null http://www.yourwebsite.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

    1. Yes, this would be it.
      Disable the WP-Cron function and the throttling goes away as shown above.
      Unless you have some renegade plug-ins doing a lot more damage.

  6. I was attempting this on BlueHost and tried /usr/bin/wget mywebsite/wp-cron.php?doing_wp_cron and keep getting the error

    Connecting to mywebsite.com|198.57.208.2|:443… connected.
    HTTP request sent, awaiting response… 404 Not Found
    ERROR 404: Not Found.

    We’re on BlueHost VPS but then we tried as you suggested;
    wget -O /dev/null mywebsite/wp-cron.php?doing_wp_cron

    And it has run successfully. Thanks! :-)
    J

  7. Thank you so much for this, I’ve been so frustrated trying to figure out why my website has suddenly been so slow. I went through the plugin disable/theme change/php admin repair & optimize.. none of it worked. This finally did, thanks from a novice, it was such an easy fix.

    1. Great Jen!!!
      I’m really glad this was an easy fix to speed up your WordPress theme!
      I personally was stumped when my website started slowing down for no reason and I had to do a lot of trial and error too before I found out it was the WordPress update slowing me down.
      Whenever I find something like this out I do like to share with my readers and I hope this information finds others.

  8. I believe the wget user agent is disabled by the hacker repair blacklist. You can also use curl, which is not currently on the disabled user agents list.

Comments are closed.

Scroll to Top