If you look at the best practices expounded by most WordPress professionals, you’ll find one related to plugins that goes something like this: when a plugin is deleted, it should remove all traces of itself. No meta data, no extra tables, nothing.
This approach sounds great and it feels downright refreshing to any seasoned WordPress developer. It’s clean, and it respects the existing plugin system, which follows this two-step logic:
- When you deactivate a plugin, nothing is removed, but the plugin is disabled.
- When you delete a plugin, you get a confirmation screen, and then everything is removed.
Easy right? If you’re thinking about maybe using a plugin again later, you should just deactivate it. If you never plan to use it again, you should just delete it.
The big problem: Most WordPress users have no idea about these subtleties, nor are they 100% sure if they’re going to use a plugin again. The even bigger problem: Removing certain plugin data can have disastrous consequences. If someone has used a plugin extensively to set up their site, deletes it for any multitude of reasons, and then re-installs it, everything is gone.
Did you know that Surf Office, Postmatic, Yeah Dave, and over 700,000 small businesses run their websites with Make, our free WordPress page builder. Discover the Make page builder now.
An example: An SEO plugin that sets lots of custom data for each post or page based on a user’s specific settings and content. If the plugin follows this best practice, all that data is wiped when the plugin is deleted.
Reasons why someone might delete a plugin and re-install it:
- Someone tells them to disable all their plugins as a debugging exercise. They might just delete them because they don’t know the difference.
- They’ve tried modifying the plugin using the editor and want to get back to a “clean” state.
- They delete it in an act of despair, and then later realize they actually do want the plugin again.
- They’ve been told to try “reinstalling the plugin”.
In all of these situations, the user will be happy to see all of their settings and data in place when they reinstall the plugin. On the flip side, if they spent lots of time setting up a plugin, they could become enraged if everything they set up is suddenly gone.
We have two competing interests: the potential for a very angry and discouraged user vs. a pile of leftover plugin data. Most developers (myself included) cringe at this leftover pile of data. It just seems so wrong to leave it lying around. But, is it really that bad? I would argue no. The potential for disaster and disappointment far outweighs keeping things clean and tidy.
Keeping things super clean and tidy should be relegated to developer level tools, for people who care about that sort of thing. For example, an AppZapper like plugin for WordPress. AppZapper is an application for Mac OS X that labels itself as the “the uninstaller Apple forgot”. The premise: Applications install support files on your computer that generate clutter. These files save settings and other data used by the application. AppZapper finds and destroys them. This is a great tool for people who find this important (I’ve used it myself). The key takeaway: this isn’t something Apple “forgot”. It’s likely something they did intentionally to make the user experience better. They chose to always preserve user settings at the cost of some extra hidden clutter. I’d take that trade every time. Would you?
Enjoy this post? Read more like it in From the workshop.