When you think of uninstall, do you think of completely removing something? The official definition for the word is as follows, (uninstall) To remove completely from a system. I ask this question because I have discovered a problem that needs to be addressed by WordPress plugin authors.
Over the lifespan of a WordPress installation, there may be a number of plugins that are installed and subsequently uninstalled. Typically, the installation of a WordPress plugin consist of uploading files, folders and then activating the plugin within the admin panel. However, some plugins include a bonus. These are the plugins that create database entries either in the form of tables or data.
I’ve used WordPress for over 7 months now, and for those 7 months, I believed that when I deleted the folders and files that were attributed to a plugin, that it was in fact, uninstalled. Only now have I come to realize that this is not the case. Sure, the folders and hardcoded files for the plugin might be deleted, but if that plugin created any database entries, those are left behind unless the plugin author added the ability to delete entries made by the plugin. What does this all mean? It means that over time, your database may be filling up with garbage data that is difficult to get rid of unless your familiar with PHPMyAdmin and working with the actual database. Not to mention, playing with the actual database is risky business. All of this gook that accumulates in the database adds to its size and can cause problems somewhere down the line.
So, I got a hold of a few plugin developers and asked them what the problem was. I thought it had to do with the WordPress Core not providing a way for plugin authors to easily code in uninstall instructions. However, it appears as though this responsibility is entirely of the plugin author. When I consulted with Ronald Huereca, author of the popular plugin WP Ajax Edit Comments and asked him who was responsible for the removal of database code, he replied with:
It is the plugin author’s responsibility to delete any necessary overhead (including options and/or database tables) that a plugin might use. The plugin author can have the user do this manually or at deactivation. But at least have some kind of option.
The purpose of this post is not to chastise WordPress plugin developers but instead, raise awareness of an issue that I don’t think too many people know about. I would be grateful if any of the plugin authors out there would comment on this post and answer a few questions I had.
Why have so many plugin authors neglected to add this functionality to their plugin?
What are some solutions that plugin authors could use to easily add this option to their code?
Should there be tighter restrictions on how a plugin gets into the WordPress.org plugin database?
Looking forward to hearing your responses.