383 – Remove a WordPress Plugin and its Data
Announcements
Is there a plugin for that?
With more than 50,000 plugins in the WordPress repository, it’s hard to find the perfect one. Each week, I will highlight an interesting plugin form the repository.
For more great plugins, download my 50 Most Useful Plugins eBook.
IdeaPush is a plugin that you can add an awesome feature/idea request system to your WordPress site.
Remove a WordPress Plugin and it’s Data
I saw a great article this week on WPMUDev talking about how to remove a plugin and all of it’s data and I thought it would be a great podcast episode.
In the show we talked about:
- what typically happens when you remove a plugin
- the tables that the data lives in
- how to remove the information from the database
- and what files need to be removed from the server
Thank You!
Thank you to those who use my affiliate links. As you know I make a small commission when someone uses my link and I want to say thank you to the following people. For all my recommended resources, go to my Resources Page
Full Transcript
Business Transcription is provided by GMR Transcription.On today’s episode we are going to talk about how to properly remove a WordPress plugin and all its data right here on Your Website Engineer podcast episode No. 383.
Hello and welcome to another episode of Your Website Engineer podcast. My name is Dustin Hartzler and today we’re going to be discovering the best way and the right way to remove and completely get rid of all the data from a WordPress plugin. But first, I’ve got two announcements and a plugin to share with you. The first announcement is that you may see this in your WordPress dashboard but, WordPress 4.9.5 Security and Maintenance Release has been released. And that was just actually today it came out, the day that I’m recording this, on Tuesday. And it is a security and maintenance release. That means that there is a version for all versions all the way back to WordPress 3.7. Now I don’t recommend running WordPress 3.7, but if you happen to be on a legacy version of WordPress, then you will have the opportunity to update to the latest version that includes these security and maintenance fixes.
There were three main things that they fixed and worked on in this version and it was: do not treat local hosts as the same host by default, you save free directs when redirecting the login page if SSL is forced, and make sure the version string is correctly escaped for generator tags. Now if that makes any sense to you – congratulations – otherwise, just know that these things are making WordPress harder and harder for people to hack into, and just making it overall, a more secure platform. There was also twenty-five other bugs that were fixed in WordPress 4.9.5 and it had a bunch of people that helped. There was a whole handful of people – there was twenty-five plus people that helped out and contributed to this version of core, so if you haven’t updated, or if your site is not set to automatically update, make sure that you do that this week. That is something – an action item to take away – make sure you update to the latest version this week.
The other news that I want to share with you this week is there’s been some recent changes to the WordPress plugin directory. They’ve changed the warning label for old plugins to show a version-based warning rather than a time-based version, or a time-based warning. So instead of saying that it hasn’t been tested in the last year or hasn’t been updated in the last year, it now says this plugin hasn’t been tested with the latest two revisions of WordPress. So, just a little bit of changing in nomenclature there. It also gives a – there’s a warning that comes if the keys – or the warning messages actually just come off the information – the README text. So, if the developer didn’t update the README file, then it's going to think that it’s not compatible with the latest version. So, that’s kind of – some of the new things that have happened in the WordPress directory.
Also, just to know that even if a plugin hasn’t been updated in the last seven versions of WordPress, it still could work. It doesn’t mean that it’s completely broken, but just factor that in when you are thinking about installing a plugin that hasn’t been updated in quite a while. That is the news for the week.
Up next, the plugin of the week is called IdeaPush. With IdeaPush you can add an awesome feature or idea request system to your WordPress site. You can use this to generate new ideas, or get generates from actual users and customers. And you can use this to support or to triage your support system, or you can use it for anything that you want. So, it is a brand new plugin. It’s got a handful of people that are using it, but it allows you to just go in and allow people to add suggestions on what you should fix, or what you should change on your current WordPress website. So that is the plugin of the week.
Now moving right along, I’m going very quickly here, but moving right along to the main part of the show and this is an article that I found on WPMUDev.org. And I’m not going to try to highlight it or – the entire article or whatnot. I just want to point out that you can go and you can read the entire article in the show notes for episode No. 383. But the title of that article was, “How to Fully Uninstall a WordPress Plugin.” And I got to thinking, that’s really great information. You normally install – uninstall a plugin by going to the plugin section, you deactivate, and then you uninstall, but that usually doesn’t get rid of all the data. You know, a lot of times there’s plugins out there that – they like to keep the data there so in case you uninstall the plugin and you reinstall it, you don’t have to re-setup all the settings.
I think this is especially true with WooCommerce. WooCommerce you have to explicitly say ‘delete all data’ when you remove it and all the extensions will – A lot of times we’ll tell customers that come in, and they have questions about their WooCommerce extension, just okay, let’s go ahead and remove it and then add the latest version. And nothing really happens because they’ve uninstalled it, or they basically deactivated it, they deleted it, and then they uploaded the new version and all their data is still safe and secure. But what if you want to get rid of all that data? So that’s kind of what my thought process was, and I was like – this would be a great podcast episode. I don’t think I’ve ever talked about this in all of the episodes that we’ve talked about. I don’t think we’ve ever talked about this.
So I just want to go through kind of the points of this article and just kind of talk through some of the places where data stored, how to get rid of some of this information, and what we can do to just kind of clean up our website and make it run that much faster. So I guess one of the things to just let you know is the database size really does matter, because the more records that you have in your database, the longer it’s going to take to query the real records that you have in there. So, say for example you have thousands upon thousands – millions, let’s say millions – of comments on your WordPress site. And so, when somebody goes to a post, or your most recent blog post, or your most recent podcast episode, and there’s say fifteen thousand spam comments are linked to that post itself, even if you’ve spammed them and they’re just marked as spam and they’re still in the WordPress database, then WordPress has to go through the database, the comments table and its gotta search through all of the records to find all of the comments associated with a particular post. And if you just get rid of those that’s going to help that search go much, much faster. So that’s kind of the main reason that we’re talking about this and the main reason why we would want to make our database lighter, so it loads faster and then it just gives our customers, or our users to our website, a much better experience.
So, where do plugins, or what plugins typically store data? Let’s start there. Let’s talk about the ones that typically store data, and then where do they store it? And then let’s kind of just rock and roll from there.
So, plugins typically store data – there are a lot of them that are out there – but typically they’re form plugins, caching plugins, SEO plugins, security plugins, e-commerce plugins. Those are the main ones that are storing stuff. Almost every plugin stores some sort of data somewhere. The – most of them store it in the wp_options database table. That’s where a lot of information is set. And that’s where the tricky part is to remove the options from the wp_options table. We’ll get to that in just a little bit.
But, most of the plugins nowadays are starting to add their own custom database tables. And, this just makes your database even bigger, and bigger. And when you uninstall a plugin, you’ve got now all these rows and rows and rows of database rows that are not even being used. And so that’s where plugins are stored. So, they’re either stored in the wp_options folder or the wp_options table. I know the plugin that I’ve written is the As Heard On plugin, and I store all of my options in the wp_options table. I guess those are all my settings. They’re all in that table. And then I’ve also created a table as well that’s a custom table so that I can put all the data – I can lay it out exactly the way that I need to and make it easy for people to query and find the information that they need. And so, some plugins like that can store information in multiple places.
Also, plugins like WooCommerce can store things in multiple tables. With WooCommerce, when you install WooCommerce, it probably adds an extra fifteen to twenty tables in your database because there’s a table for your taxes, and there’s a table for your shipping zones, and there’s a table for your shipping rates, and there’s a table for your orders, and your – All of this information is stored in all of these different places and it can get very, very unwieldy if you have a website that’s had a lot of plugins, and you’ve uninstalled them, and then you rolled this to another server somewhere else, and you’ve moved it, and now you still have all that legacy data that needs to be removed.
By default, a new version of WordPress will have twelve tables and they are: the comment meta, comment, links, options, post meta, post, term meta, terms, term relationships, term taxonomies, user meta and users. And so, I guess – so those are the twelve tables that come with WordPress. If you use a multi-site installation, then you have a few more. There are 6 more that go on to a multi-site. And those are the ones that you’ll see when you start WordPress.
Now if you use a phpMyAdmin to look at your database, you’ll see a bunch more than twelve if you’ve installed plugins on your WordPress website. So those are where those are housed and that’s where some data can live. Another place that data can live for these plugins is in the wp-content folder and they basically can go into plugins, or themes, or even upload sometimes. I’ve seen sub-folders in there. Especially if you’re using some sort of slide show or some sort of photography type plugin, or even backups sometimes get backed up into the uploads folder. That’s where you’re gonna see a lot of information. Obviously the plugin files will be in the plugins folder, the theme files will be in the themes folder, but a lot of information is stored there on the server as well. So you’ve got a lot of information that’s on the server, you’ve got a lot of information in the database, and all of that kind of just sticks around.
Well, when you delete a plugin from the repository, or you use the WordPress dashboard to delete a plugin, it’s going to remove all the files on your server. For the most part, it’s going to get rid of all the plugin files. It’s not going to go in and delete the files that were uploaded or the backups that were uploaded or anything like that. Just mainly the plugin files themselves are going to be removed when you delete them from the WordPress dashboard.
So, for an example, in this article it talks about Gravity Forms. So, Gravity Forms is a plugin that has an uninstaller already included with it. And with the uninstaller, you can go to forms, and then settings, and then uninstall – you click on a button, and then you choose “ok” and you go to the plugin screen and you absolutely – you delete everything. And this will get rid of the nine new database tables that are added by Gravity Forms. And, it gets all the data out of those nine custom tables, but then there’s a little bit of data that remains in the wp_options table. So, you’re not going to get everything with Gravity Forms when you remove it, but you’re gonna get almost all of it.
WordFence is another plugin that’s out there, and its got a whopping twenty-three database tables that are created when you install this plugin. And it’s got a bunch of information just talking about – it’s all of the tables that are just storing data whether it’s people logging in, or it’s people that are trying to – there’s scanners for your website, or reverse cache, or notifications, or blocked IP login and whatnot. So, all of these tables are there, and you can uninstall with their manual uninstall. They’ve got an assistant plugin that can do that and they get rid of everything. It gets rid of all the database and the files and they’re all purged with WordFence and so, everything is gone when you use the uninstaller properly.
There’s some of the well-known plugins that are out there like Broken Link Checker, the WP Rocket – there’s a whole handful of them out there that have an uninstall script built right in and you want to make sure that you run that as the proper way to get rid of the plugin. You won’t go to deactivate and then delete, you’ll go in to their settings, and you go to their uninstall area, and then you walk through the steps there. And then that will remove all the data and it will remove the plugin files as well. So that is that. That’s kind of the way to do it.
With WooCommerce, for example, it creates sixteen tables and then there’s a line in your PHP or your wp-config file that you can use to remove all the data. You basically say, Wordpre –. or ‘WC_Remove_AllRemove_Data’ and you set that to true, and you can get rid of all the pieces of data within your WordPress website. So that’s another way that you can do it. You can do this and you can get rid of all of your data.
Now what about those plugins that leave some data behind? You know, there’s a whole bunch of them out there that don’t do a good job. Like Yoast is one that talks about – there’s a lot of data that’s stored within Yoast. Even if you deactivate and delete, the uninstall leaves all kinds of data behind in these special Yoast database tables. So, what you can do is – well first off, let’s go ahead and backup your website. You want to make sure that you have a backup of all your files and your database in case you make a mistake, or in case you delete a file that’s not – that you shouldn’t have deleted. You can go ahead and just back everything up.
Now you want to remove those unwanted database tables, you’ll have to go in to phpMyAdmin. It’s a database manipulation tool that most hosting control panels will give you access to, but if not, you may have to work with your host to try to figure out how to get rid of some of these database tables. Now, there’s different ways that you can do this. You can just basically click on the table itself and then you can go to “Drop” and it will automatically drop and it will say “You are going to destroy a complete table. Do you want to execute the Drop Table command?” and you can select “Ok”. You can do that. You can do multiple at any one time so if you want to do two, three, four – if you want to knock out all the Yoast SEO ones at one time, you can, and you can just go ahead and kind of wipe all of those out.
There’s a plugin out there called Advanced Database Cleaner plugin that will allow you to inspect your tables within WordPress and, there’s a button in this plugin to detect orphan tables. You need the Pro version of the plugin to do this, but this will go through and it will look to see – it will kind of do a compare and contrast to see what plugins you have available and installed, versus what’s in the WordPress database. And it will go through and try to get rid of all that information that’s in there and try to clean up your database as best it can.
So, once we’ve got the database really kind of set in place and we’ve taken some time and we’ve deleted those extra tables and the extra rows – and I would say at first, let’s just go ahead and get rid of those extra tables. Then you might do a quick scan through the wp_options table. This one’s going to have thousands upon thousands of rows. And if you see anything that may be related to one of those plugins, you can go ahead and delete that as well. If you get all of the database tables removed but not the wp_options table, that’s probably okay and your site is still going to be much better for getting rid of those older tables. Then you want to go into your wp-content folder – you’ll need an FTP Editor to do this – and you want to delete those redundant folders from your wp-content folder.
So, you just go in and you check to make sure that there are no – the plugin file has been completely removed. I’ve never really seen or experienced the opportunity to – I deleted a plugin and now it’s still in the WordPress wp-content folder. Most of the time it's always removed, but it's those other folders that you’re looking for. Maybe if you use the EWWW Image Optimizer, this adds an ewww folder and, so you want to go ahead and remove all that kind of stuff. You know, sometimes if you’re using a caching plugin, there’s an advanced-cache.php and a cache folder kind of hanging out there, so you want to remove those things as well.
Those are the next steps, so we’ve removed the database, we’ve removed the files from our server, and then you want to check a couple more things. You want to look in the wp-config file and the htaccess file and so you want to make sure that there’s anything that could be in there that could look – that looks like it was added, or you’ve added it to do something with the plugin. So, for an example, a few minutes ago when we talked about adding that line of code to delete WooCommerce and delete all its data – okay we’ve removed WooCommerce. So, we can go to the wp-config.php file and remove that line that we’ve added. And then in the htaccess file, look for the hash tag (#) and then follow by a plugin name and remove any lines in between. So, most of the time a plugin developer, if they’re going to add things to the htaccess file, they will say like ‘start this plugin’ and then they’ll say, ‘end this plugin’ and then you can remove everything in between. So, you can go ahead and do that.
The last thing I want to share with you, and this one is overlooked a lot, and I know that I haven’t done this in a while for YourWebsiteEngineer.com, but you can clean up transients and cron jobs. So, transients are data that are stored temporarily by WordPress. It checks for WordPress updates and notices in the Admin Dashboard. Those are all stored in transients. Transients are mostly set to expire after a set time period and they’re recreated after – over time. And there are some plugins can create transients as well, and there’s a plugin called Transient Manager, and it will help you identify which plugins have done so and, you can delete any ones that you no longer wish to keep. The “Deleting All Transients” won’t remove them all. The WordPress ones will remain. So, you can try to delete them all, but the ones that are necessary for WordPress to run, those ones will not be deleted with the Transient Manager.
Now cron jobs, that’s another thing – kind of a term in the WordPress space – cron jobs are scheduled tasks that can run on a web server. So, WordPress runs its own cron jobs through wp-cron and this basically allows scheduled posts to go out – it does a whole bunch of things behind the scenes. There’s a plugin called WP Crontrol and it will show you what cron jobs are running and when. I had a ticket a few weeks ago that was talking about – they had installed WooCommerce, and then they had installed the Square plugin, and then they removed the Square plugin. But yet the WP Crontrol was still showing things happening for the Square plugin even though it wasn’t even installed anymore. So, it took a little digging and diving but we wouldn’t have known that unless we were looking in the WP Crontrol plugin.
So, you can modify and delete cron jobs, but some core cron jobs can’t be modified or deleted. So, you’re kind of at the mercy of the developer when it comes to naming the cron jobs. If the name of the cron job is unclear, don’t delete it because it may perform – it may be related to something other than what you think it is.
Alright, so in the recap you think that the topic of deleting a WordPress plugin and all its data is pretty simple, but in reality, it's not nearly as straightforward as it appears. A lot of information is stored both on the server and in the database, and plugin developers have a wide range of what they think is best for when somebody uninstalls their plugin. So, most of the time we can assume that uninstalling means deleting data, but that’s not regularly the case. I would say it’s probably the flip. I’d say most of the time you uninstall a plugin most likely, unless you specifically say ‘delete all data’, the data is going to be remaining there.
So, think about that if you’re a plugin developer. Think about the thought of somebody trying to uninstall their plugin – your plugin – and get rid of that data if it’s not necessary. And if your user takes some time and tests those plugins carefully, find out from the developers how you uninstall them – if there’s a special way, or if there’s a way to do that. And you can test out a plugin on a staging site rather than your live site to keep your site clutter-free. Especially if you’re just trying a few handful of plugins out, you know you don’t want to try six social widgets and pick the last one. Now you’ve got five social widgets with all kinds of settings and things kind of on your main site. So, test them out on a development site.
So that’s what I want to share with you this week. That’s what was really interesting – a really interesting topic. And it was fun to kind of talk through that and think through that and try to figure out the best way to do this. And so I think we’ve got a little spring cleaning, as it is here April and spring in North America, or the Northern Hemisphere. And so it’s time to go through and clean out that WordPress database, make your website run a little faster, get rid of those plugins that you’re not using anymore, and then if you’ve gotten rid of the plugins, try to get rid of those tables and all the extra files that are host on your server.
So that’s what I want to share with you this week. Take care and we’ll talk again next week. Bye-bye.

