How to Uninstall WordPress Plugins Cleanly

How to Uninstall WordPress Plugins Cleanly

Plugins are the lifeblood of the WordPress ecosystem. When choosing a website or blogging platform, the core extensibility of WordPress through plugins is often a major factor in choosing to go the WP route. That said, however, not all plugins are created equal. Nor do all plugins need to remain active all the time. We want to show you how to uninstall WordPress plugins so that when and if you need to remove one, you don’t have to deal with plugin fragments and orphaned tables cluttering up your site files.

It’s not an uncommon occurrence for WordPress users to conflate plugin deactivation with plugin uninstalling. After all, both actions remove the plugin from your site, so one is just as good as the other, right? Well, no. Not exactly.

Plugin deactivation is just that. Deactivation. The plugin will no longer be active on your site, meaning that any features it enables will no longer function. Whenever you install a plugin, you Activate it before it can work. In the Plugins menu, you can similarly deactivate each plugin individually.

Doing so will not remove the plugin files and settings from your site. You may reactivate them at any time.

Deleting or uninstalling a plugin, however, will remove the plugin files from your site. Or at least most of them.

Most people uninstall WordPress plugins because they’re finished with them. For you, maybe you have outgrown the need for its features, have found a replacement, or even just don’t like it.

Another major reason to uninstall is that the plugin is causing site issues. The plugin might have a security hole in it that could compromise your site’s data. Maybe it already has. There might be a conflict between your theme and the plugin, or the developers could have stopped development and its no longer compatible with the most current versions of WordPress.

Most of these issues can be alleviated with simply deactivating the plugin (as we show above). But the potentially compromised files still exist on your server. And those need to be removed. Thus, uninstalling.

Uninstalling a WordPress plugin from your WP admin dashboard is simple. Go into Plugins – Installed Plugins to see the entire list of what you have installed.

From there, you must deactivate any plugin you intend to uninstall. You can either click the deactivate button that we showed above, or you can check the box beside any number of plugins and select Deactivate from the Bulk Actions dropdown menu.

When that process has finished, you just need to repeat it, only this time selecting Delete from the dropdown.

Keep in mind that once you click the button to remove the plugin, you must reinstall it if you change your mind.

In many cases, uninstalling a WordPress plugin removes the folders and files it created in the /wp-content/plugins/ directory of your server. That will be a clean break, and you can be sure that your server’s inode and storage usage will go down.

Some plugins, however, don’t just attach themselves to your site via the files you install. Some plugins alter the WordPress core databases by creating tables and managing data using WP core itself. (This is normal behavior, by the way. Don’t worry that this happens.) Some plugins that work to protect your site from intrusions might alter your .htaccess file (so might redirection plugins).

However, upon uninstallation, some plugins don’t remove their respective database tables and entries. In some cases, this is because the developers want to maintain user settings in case you ever reinstall. But barring that, some plugins just leave bits and bytes of data that can eventually clog up your server and start affecting performance and query times.

Additionally, some plugins leave traces of their files in your file system itself. For example, you may use a backup plugin but decide to uninstall it for a time. In most cases, the backup plugin’s folders will remain because they contain your site backups. In this case, this is a failsafe to keep your site secure. However, some plugins just leave orphaned files you might want to clean up.

Part of knowing how to uninstall WordPress plugins is knowing that it’s not 100% necessary to remove every single file. If you’re a beginning WordPress user or you don’t know a lot about the WP file structure (or just don’t want to get that deep), don’t worry about it. The likelihood of the orphaned files and database tables affecting you are pretty low.

However, if your site relies on every 0.1s of page speed that you can eke out, cleaning up the file system and database could be just what you’re looking for.

SFTP is the most secure way that you can remove these files from your server. Within your webhost, you can set up FTP credentials for any website hosted there. On Siteground, the Site Tools section for each website has an FTP Accounts tab where you can create as many accounts with SFTP permissions as you want.

With that done, use those credentials to log in via an FTP client like FileZilla. Use Quickconnect (1) for ease, but you can also save your login information under the File menu.

Once logged in, you will see your site’s directory structure on the right (2), and your computer’s in the left panes. Navigate on your site to /wp-content/plugins/ (3) and locate the plugin’s files. The name is usually something similar to its title, though not always exact. For example, the plugin we uninstalled was called RSS Importer but the directory was /import-xml-feed(4).

Right click the folder you want to remove and select Download (5). Note, this won’t delete the plugin’s files, but instead put them on your local system, backing them up just in case something goes awry. With that done, right click again and select Delete (6).

When asked to confirm the deletion, click Yes. And that’s that. The plugin’s remaining files have been successfully removed from your site by SFTP.

While files can be handled easily via SFTP, dealing with the database itself can be a little more tricky. Now, this is a very advanced part of the post, and we don’t recommend this for everyone. However, if you really need your site to be squeaky clean, this is how to do it.

Remember, though, back up your site first. Whenever you tinker with the WordPress database, back up your site. Things go wrong, tables get dropped, and your site might go offline. So having a quick backup to restore is imperative.

With that in mind, you probably want to use the Advanced Database Cleaner plugin for this.

You might find it odd to use a plugin to get rid of plugins, but this one makes dealing with your DB so simple that it’s worth it. (Plus, it uninstalls clean!)

The WP DB Cleaner menu item takes you to a simple page where you can see all the orphaned and generally wasted space in your database.

You will notice that not everything here is plugin related. In the screenshot above, there are over 4,500 post revisions that are being stored. To the right of each category, you can set a number of days to exclude. For example, we have it set to exclude the past 14 days of post revisions just in case they are needed for, well…revisions. You can select the elements to purge, select Clean, and your site will get much smoother.

For more specifically plugin-related data, you will go into the Tables tab.

Tables are generally named in a decently readable format, and you can likely figure out what plugin they belong to. The Pro version of the plugin will tell you that information (and it’s only $39 for two site licenses, which is well worth it).

All of the tables listed here are from plugins that are no longer installed. For instance, the ones beginning with wp_defender_ is from the wpmudev plugin, Defender Pro. The wp_gamipress_ tables are from Gamipress. Not all of these tables have data in them, but all of them exist as data in the db.

Select the tables you want to optimize (the plugin does offer the suggestions for the ones in most dire need). From the dropdown, you can select to Optimize, Repair, Delete, or Empty the Rows.

We suggest that you only use Delete sparingly and when you know absolutely certain that removing that table will cause no problems. That’s how to completely clean it. (We might have broken a WordPress site while working on this post by being cavalier with deleting tables.) We suggest using the Optimize option.

And finally, the bane of plugin users everywhere…shortcodes. We actually like shortcodes here at Elegant Themes and think they’re a fantastic way to create functionality. One of the issues with them, however, that if you ever stop using a plugin (even by deactivating it and not uninstalling), the plugin stops working. And you have a non-rendered shortcode that will show up on your site as raw text, like [shortcode param=”render_something” time=”always]

This is actually a very easy, if manual, fix. Go into your web host and find the access to phpMyAdmin. In SiteGround, that’s in Site Tools – Site – MySQL – phpMyAdmin (tab). Press the Access phpMyAdmin button.

phpMyAdmin can be pretty complicated, but this part isn’t. Navigate to Search (not Query) and then enter your query. We searched for [et_ because that is the shortcode prefix we use here with Divi, and we know the shortcode will show up a lot.

As you can see, the shortcode is visible in the post_content column. You can also see which individual post ID numbers and titles, too. You can then handle this two ways. First, you can click the Edit button to the left and take out the shortcode in the database.

Additionally, you can manually go into the posts and pages in the WordPress dashboard and use the post editor to remove them as well. Searching the database like this is the best way to find which posts and pages the shortcode is in. Fortunately, in most cases, the shortcodes are not in nearly every post, but only a handful.

Additionally, plugins such as Shortcode Cleaner Lite/Pro and Better Search and Replace can dig through the database for you and wipe them out in no time flat.

Any time that you have plugins on your WordPress site, the chance you will need to deactivate or uninstall them is there. Whether it’s for troubleshooting an issue or simply being finished with their functionality, we hope that no matter your reasoning, you now know how to uninstall a WordPress plugin the right way. There’s not really a wrong way to do it, but as you can see, some methods might be a little cleaner than others.

What are your experiences with uninstalling WordPress plugins?

Images Powered by Shutterstock