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.
After, what my CPU Throttling looks like all the time now.
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.
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.
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.
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.
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.
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.