Someone asked me why WordPress always says it’s going to delete files and data when it only removes the files and not the database options. There are two parts of the answer to this, one being a little historical and the other being a bit unhelpful.
The Message: Delete Files and Data
Once upon a time, when you uninstalled a WordPress plugin, it looked something like this:
That was a very simple screen. You were asked to delete the plugin files, you clicked that you were, done.
Now you see this thanks to Shiny Updates:
It’s a different message, telling you it’s deleting data!
What Is The Data?
The part you don’t see is that WordPress would also remove all the data as well as those files.
Any time WordPress showed you that message to delete files and data, it was saying that it found a file called
uninstall.php which would, presumably, delete the data set by the plugin. By this I mean the options and settings you chose for your plugin. Some plugins have data and others don’t. For example, Hello Dolly has no data, just files. It doesn’t need an uninstall file. On the other hand, a plugin like Jetpack has a lot of settings it should remove from the database on cleanup.
Why Do We See ‘and Data’ If There’s None?
Okay, so if Hello Dolly has no data to delete, why did we see that message? In part, this stems from the following idea:
We wanted it to be more clear as to what was being deleted when you delete, and that was part of a proposed change to WordPress core to tell you if and when database settings are removed on uninstall, and let you leave it alone if needed. Wouldn’t that be nice? Letting you pick which way to go?
Well. There’s a problem with that dream, and the name of the problem is “Plugin Frameworks.” No, not the CMB2 stuff, I mean the boilerplate plugin frameworks that are oh so popular.
I hate them. Because they always have an uninstall, and most of the time people leave it alone. That’s right, your brilliant boilerplate will flag an alert that it’s deleting data when it’s not. This doesn’t impact the functionality of the base idea, but it does change the message.
So Why Does It Say Data?
Because when you uninstall a plugin, if it was well written, it removes the files and the data.