How to Uninstall WordPress Plugins Cleanly

Posted on June 4, 2018 by in Tips & Tricks | 25 comments

How to Uninstall WordPress Plugins Cleanly

When uninstalling software, the process sometimes leaves some remnant files and data behind. One of the reasons is that if you want to install it again down the line, you won’t lose your settings. It sounds practical and logical, but in reality, it often leaves you with both cluttered systems and WordPress installations.

WordPress does a great job of removing most leftover data when you uninstall a plugin, but it’s not perfect. This means you may need to delete files and data manually, which we’ll teach you to do in this article. Before that, let’s talk a bit about why this happens in WordPress and why it can be such a pain!

What Happens When You Uninstall WordPress Plugins

Uninstalling plugins in WordPress is simple – jump over to the Plugins tab on your dashboard, deactivate one or more, then hit the Uninstall button. If you prefer a more manual approach, you can access your website via File Transfer Protocol (FTP) and remove the plugin folders directly from your server. However, this approach doesn’t take into account any relevant database entries.

Here’s part of the problem. It’s often not enough just to delete a plugin’s files, you also need to clean your database of any related entries to them. When it comes to an Operating System (OS) such as Windows, this means removing entries from your registry. Within WordPress, it means dropping tables related to a plugin from your database.

However, leaving files or entries in your database doesn’t ultimately affect the way WordPress works in most cases. However, files add up, which means you’re wasting storage space. The larger your database gets, the longer your loading times may become. Most plugins are quite good when it comes to cleaning up after themselves. However, others have a reputation for leaving stuff behind.

In most cases, if you’re using popular plugins, you shouldn’t have to worry too much about cleaning up after them. Some will even ask you if you want to remove all related files, or leave settings-specific files behind to offer a way of saving your settings upon uninstallation. However, things aren’t always perfect, so knowing how to tidy things up after uninstalling ‘messy’ plugins can come in handy.

How to Uninstall WordPress Plugins Cleanly (In 3 Steps)

While we won’t walk you through how to uninstall WordPress plugins here, we’ll instead pick up after the process has been completed. Before you jump to step one, we recommend you backup your website. Since we’re going to be deleting files and database entries, there’s a small chance of something going wrong, playing it safe is a sound plan.

Step #1: Remove Any Leftover Files Using FTP

WordPress keeps files related to each plugin within easy-to-locate and unique folders. To access them, we recommend using an FTP client such as FileZilla, which is much easier than other methods, such as using your cPanel’s file browser.

Once you login via FTP, navigate to the public_html > wp-content > plugins folder. Keep in mind – your WordPress root folder may be named something different than public_html depending on your host (such as www or your website’s name, for example). In any case, once you enter the plugins directory, you’ll find folders for each plugin set up on your website:

Your WordPress plugin folders.

Ideally, you should recognize the folder names in this directory. If you don’t, open your WordPress dashboard, jump to the Plugins tab, and check out which ones are installed on your website. There should be an equal number of plugins and folders within the plugins directory, regardless of which ones are active or not. If you have a greater number of folders within plugins, one of your previously uninstalled plugins has left some files behind. You can safely delete the folder by right-clicking and choosing Delete:

Deleting one of your plugin's folders.

Bear in mind that deleting the files can take some time depending on how many there are. Don’t worry – this won’t affect your site’s functionality in any way.

Step #2: Drop Any Orphaned Tables From Your Database

A lot of WordPress plugins add information to your database through their own tables. When you uninstall a plugin that leaves some (or all) of those tables behind, they’re called ‘orphaned’.

There’s a debate on whether orphaned tables really have a significant impact on your website’s performance. Assuming they do, it makes sense to clean them up. Regardless, keeping your website as tidy as possible is a good practice to maintain, so you may want to clean those tables anyway.

There are two ways to erase orphaned WordPress tables. The first one involves using a plugin such as WP-Optimize, which is designed specifically to clean up unused information from your database:

The WP-Optimize plugin.

Once you install and activate the plugin, a new WP-Optimize tab will show up on your dashboard. If you click on it, you’ll be able to choose which parts of your database to clean up. For example, you can delete existing post revisions, automatic drafts, and trashed posts. However, for this tutorial, the only setting we care about is Optimize database tables, which will take care of orphaned data:

Optimizing your database tables.

At this point, you can either click on the Run optimization button, or run all selected optimizations at once. However, we only recommend the former approach if you understand what each setting does, which is simple because they’re pretty straightforward.

In any case, when the plugin is done, you’ll see a simple Optimization complete message, and that’s it! Using a plugin is definitely the easiest method in this case. However, if you’re feeling brave, you can also try deleting orphaned tables from your database manually.

To do this, you’ll need to use a tool such as phpMyAdmin, which you should be able to access from your hosting control panel in most cases. From within phpMyAdmin, you can select the database you want to clean up, before using the Search function at the top of the screen:

Using phpMyAdmin's search feature.

Here, you’ll be able to search your database’s tables for any values you want. Since we’re cleaning up after a plugin, you’ll want to try looking for entries that include the plugin’s name.

Keep in mind – we heavily discourage you from using this method unless you’re comfortable editing databases. There’s a chance you may delete tables unrelated to the plugin you’re trying to clean up, which can obviously affect your website’s functionality. Given how tricky databases can be to navigate, using a plugin may be a better option regardless of your expertise.

Step #3: Remove Any Shortcodes Associated With the Plugin

Of course, some plugins let you to implement functionality using shortcodes. However, uninstalling those plugins usually leaves the related shortcodes behind. This means you’ll need to remove each instance manually, which can be a drain on your time.

The first solution is to add code to your functions.php file telling WordPress to disable certain shortcodes from displaying. However, this doesn’t remove the shortcode itself from your pages. What’s more, if you decide to install the plugin again, you’ll need to rededit your functions.php file. Regardless, it’s a lot of hassle when there’s an easier solution.

If you’re dealing with a plugin that’s left orphaned shortcodes behind, using a tool such as Better Search and Replace can help:

The Better Search and Replace plugin.

This plugin enables you to search for specific values within your website and replace them with others. Many use it to replace internal links, although it’s also great for removing shortcodes. Once you’ve installed and activated the plugin, navigate to the Tools > Better Search Replace tab. Inside, you’ll find two fields where you can input the value the plugin should look for and what to replace it with:

Using the search and replace feature.

Below, you can choose within which tables the plugin should replace those values. In this case, you should choose wp_posts, so the plugin will look for the shortcode you input within your pages and posts:

Choosing which table to look into.

Here’s an example of how your options should look when you use the plugin:

An example of how to use the plugin.

Note we’re leaving the Replace with field empty, so the plugin will just delete the instances of shortcode it finds. When you’re set, hit the Run Search/Replace button and let the plugin work its magic. Now check any pages containing orphaned shortcodes, and the content should be clean!


WordPress enables you to uninstall plugins in a matter of minutes, and many are removed cleanly. However, some plugins leave behind rogue files, and database entries that can end up impacting your site’s performance. If you use a lot of plugins, we recommend you look for leftover files once every few months.

As for how to deal with these unwanted files and information, here are three quick steps to get you through it:

  1. Remove any unwanted files using FTP.
  2. Drop unwanted tables from your database using phpMyAdmin.
  3. Remove any shortcode associated with the plugin from your pages.

Do you have any questions about how to uninstall WordPress plugins cleanly? Let’s talk about them in the comments section below!

Article image thumbnail by ConceptVectorDesign /

Premade Layouts

Check Out These Related Posts

Splice Video Editor: An Overview and Review

Splice Video Editor: An Overview and Review

Posted on May 7, 2019 by in Tips & Tricks

Video is a valuable form of content for social media. Unfortunately, creating quality videos is usually a long process that involves moving mobile footage to a desktop app for editing. However, mobile editing is on the rise. Apps such as Splice Video Editor make it possible to efficiently create...

View Full Post


  1. THANK YOU for posting this information.

    • You’re very welcome. 🙂

  2. There are one or two info to pick up here. However I found out that it may sometimes be difficult to removed unwanted plugin files from the phpadmin section giving the fact that they might name them something different other than what can be guessed, which makes keyword search be more difficult.

    Thanks for sharing ??

    • That’s a really good point, thanks for sharing it. And you’re very welcome, I’m glad you enjoyed the article. 🙂

  3. Wp-optimize is great plug-in but fail most of the time to clean orphan tables.
    Best practice to delete orphan table is drop the table using phpmyadmin to locate the right table is enough do a search on the files plugin you want clean up.
    Usually in enough search “CREATE TABLE” to find the right table neme

    • Just as I said above. That option of using phpadmin to find the orphanage table is not always easy.

    • Thank you very much for sharing, that’s very helpful. 🙂

  4. Helped me a lot.
    I’m optimizing my site for it to get faster.
    Thanks for your tips

    • You’re welcome!

  5. When reading tables inside of PhpMyAdmin you can search Google for anything table name and find what plugin and/or data is associated with it. Some are clearly named and some are nested inside of other tables which isn’t something that I’ve found more recently. It seems that it used to be a case for certain plugins but not all. Maybe I stopped using the ones that were prone to that behavior. Whatever be the case, cleaning out data from database tables does have an effect on performance as well in a number of tests that I’ve done. Luckily, most of the more regularly used plugins cleanly remove all of their parts.

    • Thanks for sharing that information. 🙂

  6. the best way would be if developers, including ET, would simply delete their garbage during uninstallation.
    I keep finding random entries in my database of e.g. old themes from ET. Since some tables are also indexed, it is not so easy to delete the entries. And then there is the fact that it is not always clear where these plugins or themes are registered, and above all how. (e.g. which name you use in the options table)…

    In my opinion it would be very nice if WordPress would slowly pay more attention to quality.

    • +1

      This is one of the biggest headaches with WordPress that Automattic needs to address. One, they need to mandate that plugin developers implement the uninstall function completely. Many don’t, which is why we have so much garbage left over. Right now most plugins simple remove basic data.

      Next, they need to rethink the whole structure of plugins. I hate how plugins will appear in so many different places in the menu, you forget where to find them. They’re in Settings, Tools, or graft themselves into the admin bar. Enough! Mandate one location with a clear structure on both when frontend and backed.

  7. Hi John, sounds great but surely someone can invent a plugin to do this 🙂

    • That would be great, and there may very well be one already. If anybody found one and wanted to share it, I’m sure that would be appreciated. 🙂

  8. Hi John,

    I could see many articles on optimizing WordPress database concerning security and fast loading. But, you presented explicitly about uninstalling WordPress plugin which will result in quick and effective DB functionality and website performance. Thanks for your detailed post.

    • Thank you, I’m very glad you enjoyed it. 🙂

  9. Hi,

    I used to uninstall and remove complete plug-in related files using PHPmyadmin. However, I would forget to remove the shortcode associated with plug-ins. Thanks for sharing this detailed article on uninstalling WordPress plug-ins.

    • You’re welcome, I’m really happy you found it helpful!

  10. Thanks. I’ve used a number of plugin that I don’t anymore and my database is getting a bit bloated. Good to know how to delete everything that I don’t need anymore, cleanly.

    • You’re very welcome. 🙂

  11. John,
    I appreciate the fact that YOU respond to your readers. Well done. (The rest of you ET blog authors, take note!!!)

    • Thank you Randy, I’m happy to speak with you all. 🙂

  12. thank you for writing this post. but I think wp optimize does not fully cleans the leftovers of plugins in database.

    • You’re welcome! If the plugin fails to clean everything, you might want to check out the solution that Diogene provided in an earlier comment.

Join To Download Today

Pin It on Pinterest