1. Alec

    Removing data on plugin deletion is a difficult decision for developers, Jeff. If we are talking about a massive amount of data, removing it makes a difference to performance. If we are talking about a small amount of data, particularly complex settings which you would likely want back, removing data is extremely user unfriendly.

    There should probably be an extra option next to the Delete button on the plugins page or as an interstitial checkbox option when you use the Delete button “Would you like to keep or remove Happy Forms data?” Perhaps even a second checkbox “Would you like to keep or remove Happy Forms settings?”

    I know Core WordPress team argue options complicate WordPress but hey we’re talking about professional software. There have to be options as there are decisions to be made which vary from plugin to plugin and user to user. If a decision must be made, the data and settings should be left in place for the user to remove at his/her own leisure/discretion.


  2. Matt Cromwell

    Great piece! This topic has been on my queue to write about as well for a while. Now I just get to paste this link into our negative reviews for this exact reason — and this reason only. Thanks Jeff, Justin, and Carl!


  3. Senff

    For me, uninstall means uninstall everything. If I want to stop using a plugin but keep the data for possible later use, I’ll deactivate.

    I came across a situation where I used version 1.x of some plugin, then uninstalled. Then later, I installed version 2.x of that plugin, and you guessed it, it didn’t work properly, because the orphan 1.x data threw a wrench. You can see where a table cleanup after uninstall would have been helpful here.

    Ideally, there should be 3 levels of uninstalling/deactivating:
    1. plugin not active, but files + data are kept
    2. files are removed, data is kept
    3. files + data are all removed

    However that might confuse the “common” user, so I personally think the best alternative is to have 1 + 3 only (and those are the options that my plugins have). Additional confirmation screens or options will just confuse people more, so I do think there should be a standard.


    • Joel James

      I agree to Senff. For me, uninstall means cleaning up. So the plugin should not leave anything after completely removing it.

      If you are troubleshooting or testing something, just deactivate it. Why uninstall? Unless it is a caching plugin like W3TC, deactivating is enough, if you have a plan of using it later.


    • Jay Syder

      Only reason I can think where uninstalling but keeping tables has been good is for when updating plugins that don’t come with an automated process so you wouldn’t lose your data but seems a lot more plugins have automated updates that aren’t hosted on WordPress.org.

      I have also noticed plugin developers can create custom links next to deactivate and uninstall so maybe ones that don’t have an automated process should create a custom button here for uninstall to update or something that retains tables.


    • Alec

      Senff, for security reasons, we are told not to even keep inactive plugins on our live sites. Hence the need for the option to keep either data or settings for the future, in the case we wish to use that plugin again. Jeff himself was happy that his Gravity Forms forms were still in the database.

      A final (and probably the most sensible) option would be to easily allow import and export of a plugin’s settings and data (not custom for each plugin, but registered tables and settings with a standard routine which works across all plugins).


      • Senff

        I understand the security reasons point, but shouldn’t that policy also not allow orphaned tables (of inactive/uninstalled plugins) on your live sites? Why would it not allow files of an inactive plugin, but it would allow data of an inactive plugin?

        I also recognize why Jeff was happy that the data of a deleted plugin was still available, but I consider that a lucky accident. The fact that the data was still there undid his mistake of deleting the plugin, but I believe that most of the time, deleting a plugin is not a mistake. I think the data shouldn’t be kept just in case the plugin removal is not actually what the user intended, or made it final.

        I do agree with presenting the user with the option to keep a plugin’s data (import/export), but it would probably a little too advanced for the average user.

        Another thought: have a “Trash Can” for old plugin’s settings. Just like deleted Posts and Pages have their separate space from which you can restore them, maybe a part of the database where all the “trash data” goes could be helpful. It could be restored when needed, but it would be in a separate part of the database.


  4. mark k.

    uninstall is uninstall is uninstall. It is not partial uninstall, it is not a maybe uninstall. User wanted an uninstall, and even if the user is an idiot you should respect his wishes.

    If external tables are not deleted why should anyone assume that options and such do get deleted? Unless it is a bug or oversight, it is a good sign to stay away from the plugins that do it.

    Some things are hard to delete, like media that was specifically associated with the plugin, but that should be a very small exception to the rule of “delete everything on uninstall”

    Actually it should double apply to storage of sensitive information like financial transactions.


    • Ron

      We don’t agree all the time Mark but I agree with you 100% on this one.

      If I choose to delete a plugin then get ALL of your crap out of MY WordPress. If I made a mistake then it’s on me but no plugin dev has the right to leave anything behind when I delete.


  5. Peter V

    There are many times that I haven’t deleted a plugin through the WP plugins manager because I get the warning that it will also delete the data, and I think that I want to keep the data as I might re-install that particular plugin later. There are also times when I’ve had to reinstall plugins due to a corruption, and again I don’t want to delete the data, so I have to revert to FTP to delete the files. Conversely, there have also been many times when I look at a database and groan at how much junk there is there.

    So, like most things in life, the decision really should be mine. When I click delete in the WP plugins manager I should be given the choice to delete data. In fact, it would be nice if there were 3 options: Delete Files Only; Delete Files & Data; Delete Data Only.

    This should be a mandated part of the core WP plugins system which all plugins in the WP repository that have their own tables have to implement.


  6. IceTater

    When I uninstall programs on my desktop, there almost always is an option to retain settings & data. That makes upgrading or a reinstall much easier. Why should WP be different? It’s another option that can save loads of time.


    • Miroslav Glavic

      Most people when they want x feature, they try a few plugins, each plugin leaving their crap on the WP installation adds up to a lot of useless crap.


  7. Ashley

    I feel like all these concerns can be addressed if developers just add a simple checkbox to the plugin settings that says, “Yes, delete all data on uninstall.” A lot of plugins do that and I feel like it solves every possible issue.


  8. Otto

    I can see all sides of this one. You want to prevent users from accidentally screwing themselves over. Noble and valid.

    That said, there should always be some way to say “yes, burn it all down”. This is mainly a UI problem. But, I think it is well within the realm of solvable, given the existing hooks. If not, then perhaps a more detailed use case would be valuable to core to fix it in the best way.


    • mark k.

      sounds like what people want is “hard deactivation” or “soft uninstall” added to the plugin action links.

      I don’t see the point as when a plugin is deleted there is no more any indication that it was there so how will you know which plugin you need? So there will have to be a list of formerly deleted plugins stored somewhere as well


  9. Lewis Self

    After reading this it makes sense why some people don’t want to remove all the data after uninstall, I always delete data on uninstall. I wonder if it’s a good idea to have a checkbox in the plugin settings (unchecked by default) that asks the user if they want to remove the data on uninstall. An extra verification might make cleaner databases easier and data loss less common. Will be implementing this in my own plugins.


  10. Summer

    What about plugins that don’t create their own tables, but leave their data behind in wp_options? I’ve been surprised a few times to see options in there for plugins that had been deleted years prior to me poking around.

    Data cleanup upon uninstall should apply to stuff in the main WP tables as well.


    • Alec

      Good point Summer about orphaned data within the existing tables left by deleted plugins. I agree treatment of data should be equal, whether in separate tables or in the main tables.

      Getting uninstall write is not as simple as it looks. That simple question about data on delete suggested by Ashley and Lewis is looking awfully good.


  11. pepe

    I’m puzzled how you can write about this topic without mentioning Trac ticket #20578?


  12. Miroslav Glavic

    I think there should be an option to delete ALL the garbage left over.


  13. getimo

    Yes, please. Let us get rid of the garbage.


Comments are closed.

%d bloggers like this: