Unlike traditional website platforms which run purely on HTML, WordPress includes both files and database tables.
The core software uses some tables which are crucial for the software to work however your plugin tables aren’t.
When you install a plugin it generally adds tables to your database.
The problem is, it doesn’t delete them when you delete the plugin. It normally only deletes the plugin files.
See this screenshot as a typical example:
Its clear that this function within your dashboard only deletes the files created when you installed the plugin.
The reason most plugins don’t include the uninstall function is because the plugin author hasn’t included it in the plugin. Simply as that.
It might not work if the plugin isn’t coded correctly and most plugins are free so why would they risk it?
Plugins can have uninstall support easily built in, via an uninstall.php file (easiest way). This file simply gets executed when you select to “delete” the plugin from the Plugin Manager. Ideally, the plugin author would use this space to remove options, tables, etc.
So what next?
How do we remove all the unwanted tables left over in your database after you tried out different plugins but decided you really don’t like or need them?
There’s 2 ways to do this:
- Dig into your tables and delete them manually
- Install some more plugins which do this job for you
Plugins That Remove DB Tables
There’s several plugins which i have tested on a local installation that work well.
I’ll now give you an overview of how i used them to remove the tables left over after deleting unwanted plugins .
By the way, my DB is over 100mg and i have tested hundreds of plugins before i started using a local installation of WordPress so it’s perfect for this task.
Plugins Garbage Collector
After you install Garbage Collector, you’ll find the settings under the Tools tab in your Dashboard.
Select Search non-WP Tables and click Scan then wait.
You’ll then get a list of the non core tables still included in your database that belong to plugins which have have deactivated or deleted.
What you can do then is check them and Delete the Tables.
Sorry to sound like a broken record folks!
It’s not awalys crystal clear which plugins use which tables as some of the table names are weird but you can be assured they are non core.
Before you nearly die of boredom, let’s check out a couple more plugins which delete options and optimize your db.
This plugin cleans up any options in your wp_options table which have become orphaned after you deleted the plugin which created them.
Click Find Options.
You’ll then get a screen full of these.
Its clear most of these have been created by plugins so you can easily delete the one’s which are individually.
Any that you’re not clear on, follow the instructions to search for more info on them so you can check what they’re used for.
Option Search Box
Pretty clear this is a tedious task however you will learn a lot of how a database works if that’s your thing!
Database Optimization Plugins
There’s a couple of plugins that i use weekly which simply remove some junk.
- WP Optimize and
- WP Clean Up
I’ve already written about how to optimize your database.
They’re very basic and easy to use and should be used before you start cleaning up your tables.
Basically they Optimize your database tables and remove:
- Post revisions
- Spam Comments
Result After Cleanup
Depending on how many unused tables you cleaned up, you will find that your site will run significantly faster and more efficiently.
I know my database is now about half the size as i created a backup before and after the cleanup.
This is before i’ve even removed any options.
Feels great when you’ve optimized your db and your site loads faster!
I’ll also be writing about how to do this job manually at some stage if you’re interested.