WordPress 2.7 to Include “Uninstall” Hooks

When you deactivate and delete a plugin in WordPress, something generally stays behind. All the tables the plugin added to the database, and their respective rows, remain behind, unless the plugin developer thoughtfully included a function to wipe them before deactivating. This means, if you have the expertise, it’s a good idea to go through the database once in awhile and delete tables created by plugins that you no longer use. (Warning: Unless you’re sure you know what you’re doing, don’t mess around with the WordPress database. You could easily break something.)

The next version of WordPress, version 2.7, will take care of this though. It will include facilities that will enable a plugin’s tables to be deleted if the plugin files are deleted (not deactivated, deleted).

The apparent best method for plugin developers to make use of the feature is to create an uninstall.php script in the plugin’s directory, and add some MySQL queries to remove their tables from the database. The script will run when their plugin is deleted.

Jacob Santos has a post up about the upcoming plugin uninstaller in WP 2.7.