Recently I had to solve the problem with my WordPress site. After logging in into my WordPress website my WP dashboard became non responsive, i.e. not available, it froze. And my website became much-much slower for visitors.
It was a challenge that I love. It was the issue that I could not catch for some heck of a time during that day. But I knew it was somewhere close. “Catch me if you can” son of a birch, if you let me.
Now, with a hind sight the procedure seems obvious to me. And now I know how I will solve it if this happens again. But back then it was a day of “making love“ with my WP. And I will let you the tricks of Kamasutra that I used (and you can too) to get max out of it.
Finally we both got satisfied. I fixed my WP. And the WP got me sweat. Do you want to know how? To be prepared if this happens to you? Or it’s already happening to you? Okay.
.
CPU load 100% & my WP. What happened in short
Alright. Here’s what happened one Saturday morning not long ago. Saturday is the day when I get minimum traffic. And I decided to update my WordPress version and several plugins keeping in mind that if something goes wrong then less visitors will suffer. That was a good thought.
How do I usually update the WordPress version and the plugins? I do it the safe way. Before updating the software on the live website I first test it on the staging site (see the tutorial).
This time the update on the staging site went absolutely fine. But when updating on the main (live) website it went havoc – dashboard froze and the website became as slow as molasses. That was unexpected.
I went to my cPanel and found out that CPU load is 99% or 100%.
Okay, it was a good sign. Seriously. Because terminating the process on a server side resolved the issue at least temporally. And the visitors could continue enjoying my website. Yes, the issue was not solved, but it gave me some break to think the things over.
The hassle-free hosting option would be to use a host which takes huge extra steps to solves the performance issues for you. That’s why the specialized fully managed WP hosts are a great help to those who are not confident in technical stuff like that.
So I contacted my hosting tech support and they terminated the process that caused the CPU load. By the way, technical support can’t determine what exactly causes the CPLU load issue. All they can see is two processes which overload the CPU: index.php or/and wp-admin/update-core.php. It can be anything connected with WordPress installation itself or any part of it.
In other words, you are alone to fight this issue.
The tricky thing was that each and every time when I simply tried to login to my WP dashboard, my WordPress site got frozen and CPU overheated to 99% or 100%. And I had no other choice other than contacting the hosting technical support once again to kill the process.
Okay, I had to solve the problem without logging in into to my WordPress site.
I had basically two choices: 1. restore a backup, or 2. do something else with files or database.
Restoring a backup could seem like a good solution. But the backup did contain the flaw. And anytime later the same problem could appear. (Disclosure: I tried recovering the backup and the issue indeed re-appeared soon after that).
So I decided to face the fight and fix the issue with the current version of my website.
I’m not going to describe all the tests and trials I did. I will just briefly discuss the principle steps. And will let you know my suggestions if you are or if you get in a similar situation.
The plan to fix the cause of CPU load 100% in your WordPress site
There are three main areas where the cause of the CPU overloading issue may be hiding:
- The plugins
- WP Core conflict with plugins
- .htaccess file
And whereas the first two reasons seemed pretty obvious to me, I forgot that .htaccess file can also be a part of a puzzle. And because of it I spend a big deal of time trying to narrow down the CPU overload problem cause.
Now, with all the experience I got the hard way, here are my suggestions for you to let you go the easy way.
The plan in brief:
- Close WordPress dashboard in your browser and do not log in into it until you want to test it.
- Make your website available again (make CPU load normal again by contacting tech support).
- Make a backup of your website.
- Make a clone of your website to another host or server to experiment (optional, but recommended).
- Eliminate possible causes of the issue: disable plugins from File Manager and replace your .htaccess file(s) with default ones.
- Log in to your WP dashboard. Make sure that CPU load stays normal. Then do an iterative process by enabling plugins (one by one) to see after each action if CPU load is okay.
- Update WordPress version (if there’s a new version available).
- Enable plugins one by one from cPanel (check CPU load each time). And update the plugins one by one. Before updating each plugin make sure a new version of the plugin does not have conflicts with the WP version (from the plugin’s details). And check CPU load after each time.
- If you have found a conflicting plugin, don’t use it for now. Contact the developers.
- Finally, include in your .htaccess file(s) the necessary directives. In case any of the directives cause 100% CPU load, then you have narrowed down the cause.
- It should be fine now. If on any of the previous steps CPU load was again 100%, then you narrowed down the cause of the issue. And it needs to be addressed individually. For example, by contacting the conflicting plugin’s developers.
- Finally, if you did all the troubleshooting on your clone site, just do necessary steps on your main website.
Now let’s see these steps in more details.
1. Close WordPress dashboard in your browser
The point is clear. Since CPU overload load is caused by something initiated from WP dashboard, do not access it until you want to test it. CPU 99% or 100% makes it impossible to work from within your WP dashboard. And it makes your website awfully slow for your visitors.
2. Make your website available again, at least temporarily
The point is to make your website available for your visitors, i.e. you need to bring the CPU load on your hosting account back to normal. To do that you need to ask your hosting technical support to terminate the processes which caused 100% CPU load.
If you don’t know what “terminate the process” means, then just tell your hosting support that CPU load is too high and ask them to do something about it. And they have not much choice rather than terminate the flaw process. You website will continue working fine for your visitors now.
And since you closed your WordPress dashboard on the previous step, CPU load will not rocket to the maximum.
3. Make a backup of your website
Since you are groin to experiment with your website, make sure you have a backup. It will let you recover you website in case you screw something up completely.
4. Make a clone of your website for testing
While you are trying to fix the issue, it’s inevitable that your website will not function properly (your plugins turned off, CPU load 100% and your website not available). That’s why it makes sense to create a copy of your website on another hosting account. And do all the troubleshooting there.
5. Disable plugins from cPanel’s File Manager and replace your .htaccess file(s)
Troubleshooting actually starts here. You need to disable all the possible causes that may result into CPU overload. Then by turning it on back one by one you will be able to narrow down the issue and get rid of it.
Disabling plugins from cPanel
You can’t disable plugins from within your WordPress dashboard because as soon as you log in your WP, CPU load gets to 100% and you are stuck again. That’s why you need to disable your plugins in a different way. Go to your cPanel’s File Manager and rename the plugins’ folders.
The folders of the WP plugins are usually here: /public_html/wp-content/plugins/ (if your WordPress is installed in a subfolder, the path would be /public_html/subfolder/wp-content/plugins/)
Rename each folder by adding, for example, an underscore “_” to the end of the name of each folder. When a folder is renamed the corresponding plugin in your WordPress site gets deactivated. You can activate the plugins alter by renaming the folders back.
Replacing .htaccess files
.htaccess files may contain directives (commands) which may conflict with your WordPress site. That’s why replacing the .htaccess files with default ones makes sense when you are troubleshooting the issue.
There are two .htaccess files.
Let’s deal with the first (main) one. It is in the folder where your WordPress is installed (by default it is /public_html/)
By the way, if you don’t see .htaccess file, then make sure in the settings that hidden files are shown.
Make a copy of the .htaccess file or its content (as a backup). And replace the content of the .htaccess with the default content, which you can find here. Or simply copy this:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
The other .htaccess file is in wp-admin folder (by default it is /public_html/wp-admin/):
For now you can simply rename the file (thus it will be ignored by the system).
If there’s no .htaccess file in wp-admin folder, then go ahead.
6. Log in to your WP dashboard. Make sure that CPU load stays normal
After you deactivated the plugins and the content of the custom .htaccess files, it’s time to test if the issue with CPU overloading is gone. Log in into your WordPress dashboard. And then in your cPanel look at CPU load. It should be very much below 100% (usually it’s zero or a couple of percent).
In case the CPU load is 99% or 100% again, then this tutorial is not very helpful. It means that something else rather than plugins and/or .htaccess are causing conflict. Maybe there’s some flaw in your WP theme. You can use similar techniques described in this tutorial to test if it’s the theme causing the issue.
Anyway, let’s move on.
7. Update WordPress version
Updating the software is needed to make sure that the issue was not caused by the conflicts in the old versions.
So, as usual, update your WordPress version from your WP dashboard. And after that log out and log in your WordPress dashboard again. And then look at the CPU laod in yourcPanel. If this is fine, then go on to the next step.
In case on this step you experience CPU load 100%, then the issue is connected with something else rather than what I describe in this tutorial. My suggestion would be like in the previous section – test if it’s your WP theme which causes the conflict.
8. Enable and test the plugins one by one
In this part you find out
The procedure is pretty simple. For each plugin you do the following:
- Enable the plugin (rename the plugin’s folder in File Manager for that).
- Check CPU load in cPanel. It should be normal. In case it’s extremely high, then you have found the conflicting plugin (see the section below for further suggestions).
- If the plugin has a newer version, check the details on this plugin if it’s not conflicting with your current WP version: If you use a red note in the plugin’s details that it has conflicts with your current WordPress version, don’t update the plugin. Wait until the developers fix the compatibility issue.
- Update the plugin the usual way.
- Set up the plugin if necessary (some plugins need initial setup after activating).
- Log out and log in again to your WordPress dashboard.
- Check CPU load. If it’s too high, then the new (or may be also the old) version of this plugin is conflicting with the your WordPress site (see the section below for further suggestions).
- If CPU load is fine then move on to the next plugin.
9. If you encountered a plugin that causes 100% CPU load
If you have narrowed down a plugin which causes extremely high CPU load when it normally should not, then either get rid of the plugin or disable it. You can disable it via File Manager or the normal way from WP dashboard if the latter this is possible.
Basically, if this happens then this plugin has a conflict with some of the components of your website. It can be your theme, another plugin or even something within your hosting. If you want, you may contact the plugin’s developers and let them know the issue.
10. Getting back your .htaccess content
If you have never edited .htaccess manually before, then you don’t need to do anything now. All the .htaccess content that should be there is already there. All the necessary code was automatically added to .htaccess files when you activated and setup the plugins.
However, if you had added custom code to your .htaccess file(s), then simply add that code, log out and log in to your WordPress dashboard and check the CPU load. In case CPU load is high, then find out which exactly of the custom code pieces causes the conflict.
11. Final actions and final check if everything is fine
Log out and log in into your WordPress dashboard. And finally check CPU load. If it’s fine, then you have done resolved the CPU overload issue.
If you have been doing these tests on your testing site, then you are ready to fix your main site now.
If you have done it on the testing site, simply now do the same steps on your main site in the same order but without login out and logging in your WP dashboard multiple times. At the end, for a control check, log out and log in to your WP dashboard and check CPU load.
That’s it. You’ve done it!
BTW, I respect your privacy, and of course I don't send spam, affiliate offers or trade your emails. What I send is information that I consider useful.
Hi Michael,
Thanks for sharing these tips.
My WP dashboard used to freezes a lot while writing long posts
Thank you so much
You are welcome, Joe.
If dashboard freezes when writing a long posts, this is probably because of two reasons. If it freezes from time to time, then this means that your hosting is weak. If it freezes all the time during writing long posts, then this is a restriction of WP itself (in case of very long posts like several thousands words).
My tutorial is for the cases when dashboard freezes suddenly with ANY action in it (even if you just log in)
Dear Michael,
Thanks for the latest resource… along with your in depth knowledge (as always).
For various reasons Michael I find your emails come in at a time when I really would like to “digest” them in depth at a later point… like when its “downtime” and there is no internet around!
Would you seriously consider making access to all your very important subject matter in a downloadable format (say a PDF document)?
This would save me a great deal of time copying them to read and take in at a later time!
Your “stuff” is just too valuable to ignore… and having the time when my mind is “at its best” means not missing those all important points dispersed in your research.
just a thought,
kindly yours
Bruce Bennett
( Men’s Elective Network )
Hi Bruce,
It’s a great idea. I will do it.
Update: already done!
Hi Michael,
Thanks for sharing this unique problem with us in a very informative and detailed way. This really adds good Value & definitely gonna help everyone from recovering this problem.
And again Hats off to your Explanation. Keep up the good work…
Cheers,
Abhay
Thanks, Abhay, for your feedback. Feel free to share it to the people who may need it. With WordPress 5+ released this kind of issues has become more frequent.
Hi Michael,
Sure, I enjoyed the article. This is very important things.
Thank you so much
Hey Sazzad, glad you liked it! Thanks for your feedback.