Is your Wordpress jammed up with old plugin trash?
OK, let’s get practical to start off the week here. And a tad geeky. 🙂
Last week, I was working on my new course for Lab members. This means I was logged into the Lab as a member testing things out. As I did so, I realized that the site was SLLOOWWW.
Like, it would take up to 14 seconds to load up a page! That’s simply unacceptable. The good news is that the general public would not have noticed it since WPEngine does such a swell job of caching everything.
Anyway, what was causing this massive slowdown? I checked into the usual things:
Get THE EDGE Sent To You Every Monday!
Be sure to subscribe (for free) to have The Edge sent to you automatically every Monday morning. There’s some extra goodies in the email version you won’t find here in the archives. Just sayin’. 🙂
You will not be redirected from this post when you subscribe, so you can keep reading.
- I checked that my plugins were updated
- I checked to ensure that I actually needed all the plugins which were running
- I ran a test on GTMetrix on my site speed to see what might be happening
… and while a few items came up on my speed test, nothing which would explain a slowdown of this magnitude.
So, I hopped on the support line with WPEngine. And together, we tracked down what seems to have been a huge source of the slog.
It was the crap leftover in the options table of my database from plug-ins I no longer used. And, it was being queried in on every page load even though it wasn’t necessary. Every page load was querying over 2MB of stuff out of the options table!
So, let me explain as best as I can here…
Your database contains multiple tables. Think of it like a spreadsheet might contain multiple sheets. Same idea.
One of those tables is called “WP_OPTIONS”. It is where Wordpress stores all the settings. And, all your plug-ins store all their settings in there, too. And, SOME of those settings are set to “autoload”. This means Wordpress is set to query out those settings every time a page loads up so that it can be used.
Got it? So, you have all these records of settings for various things, all set to autoload on every page view.
Problem is, some plug-ins are just programmed by idiots. They make seriously poor use of the options table and they store a TON of info in there AND set it to autoload. Not only that, many plug-ins are not set to REMOVE that data if you remove the plug-in.
So, I had a bunch of orphaned settings that weren’t used anymore, just bloating up the options table. And, set to autoload.
If you want to check your own options table, let me give you a MySQL query that you can copy/paste. You’ll need to go into PHPMyAdmin (all hosts have it installed) and run this query.
What you’ll get is a list of the top 20 options in your table, sorted by SIZE.
Now, if you want to actually DO anything about it, you will need to delete those options manually. And you’ll need to use some judgement based on the option_name. If you look at the option name and sometimes the value, you should be able to tell which plug-in it was for. And you’ll know whether you still use that plug-in or not.
For instance, I had a ton of crap for an old opt-in forms plugin called OptinSkin. Also Wishlist Member. I saw that stuff in there and just giggled because I hadn’t used that plug-in in several years! But, look at the size of it. 867KB. Wow.
So, before you try deleting anything, definitely back everything up. In my case, WPEngine makes creating a backup point super easy. I even copied the whole site to staging in case I needed it.
Then, just delete the rows from wp_options that are no longer applicable.
I really would only worry about the super large options rows. If you can keep the total size of your autoload options below 800k, you’re probably fine. In my case, just the garbage from the old OptinSkin settings were more than that!
Once I removed some of the bigger crap from the options table, I shaved over 10 seconds off my page load time!
So, here’s the motto…
When you install and remove plug-ins from Wordpress, sometimes they leave crap in the options table. They sit there orphaned, but they still clog things up. And, it is good to go through there and remove the trash.
Lastly, if a plug-in that you’re removing has an uninstall process, use it rather than just deleting the plug-in. If you just delete it, then anything it put into the database remains. But, a proper uninstall will take the data with it.
Oh, and if you want to try a plug-in to help you do this, I found Advanced Database Cleaner. It looks nice, but I haven’t used it myself.