Ferodynamics Network

popular: profile privacy, mobile privacy

August 23, 2008

Way back in the mists of time, following an article on Weblog tools collection, I started looking at writing an uninstaller for WordPress plugins. There was a significant interest in this at the time so I wrote a patch and submitted it to core where it stayed for some time.

The process was documented in three posts: Fun with uninstallation part 1, part 2 and part 3. Note that the sample plugins that are linked to in these posts have been removed as some users were misunderstanding them and using them despite the fact that they were practically useless.

My hope that the patch would be included in WordPress 2.5 was not to be. 2.6 has also been released. Finally though, thanks to Jacob Santos who pushed it along, with 2.7 it will be possible for plugin authors to write an uninstall routine.

How to write the uninstall routine

The final implementation is actually closest to my first attempt. It bypasses the problem of creating hooks in a plugin that will not be active and does not add to the core more than it has to.

To produce the uninstaller you need to include a separate file (uninstall.php) within the plugin folder. This should include all the code needed to remove options, database tables, etc.

This file will be run when the plugin delete routine runs, so it will not be possible to uninstall the plugin without deleting it. If the plugin is deleted manually, using FTP, then the plugin will need to be re-uploaded before anything can be uninstalled.

Given that WordPress 2.7 will include a plugin installer that will let you search for and install plugins directly from the plugin repository without any FTP shenanigans it is reasonable to presume that users will usually delete the plugin through the interface as well.

I think that users might want to uninstall a plugin in order to wipe the settings so it may not be a bad idea to write the uninstaller in a way that allows it to be run manually and to trigger the plugins activation function to reinstall the defaults. I am working on an implementation of this for the next version of my fun with plugins tool.

Silence Is Golden
3 comments
page 213
Questions About Habari For Wordpress Users
6 comments
page 424
Theming Habari Vs Wordpress
13 comments
page 440
My Experience Of Flexx
4 comments
page 1026
Plugin Update Fun With Photo Data 2
one comment
page 815
Post Image The Easy Peasy Way
26 comments
page 1065
Gaining Benefits From Plugins
8 comments
page 1167
Categories Vs Tags Either Neither Or Both
12 comments
page 7
Fun With Theme Widgets
24 comments
page 867
Beware Wp Cache
8 comments
page 1310
Six Million Ways To Die Choose One
14 comments
page 1128
Post Image The Easy Peasy Way
26 comments
page 1065
Post Image The Easy Peasy Way
26 comments
page 1065
Wordpress Chat
one comment
page 1308
Post Image The Easy Peasy Way
26 comments
page 1065
Beware Wp Cache
8 comments
page 1310
Wp Polls Reviewed
one comment
page 58
Wordpress Chat
one comment
page 1308
Fun With Photo Data
12 comments
page 330
Fun With Sidebar Tabs Styling
2 comments
page 336
Html 5 Gallery
6 comments
page 1305
Using Your Own Url Shortener
4 comments
page 1190
Html 5 Gallery
6 comments
page 1305
My Experience Of Flexx
4 comments
page 1026
Fun With Sidebar Tabs
193 comments
page 57
Html 5 Gallery
6 comments
page 1305
Fun With Plugins
27 comments
page 14
Wordpress 25 Exif Fields
12 comments
page 230
Html 5 Gallery
6 comments
page 1305
Html 5 Gallery
6 comments
page 1305
Html 5 Gallery
6 comments
page 1305
Quick N Dirty Replacement Text
no comment
page 122
Beware Wp Cache
8 comments
page 1310
Theming Habari Vs Wordpress
13 comments
page 440
Fun With Sidebar Tabs Styling
2 comments
page 336
Beware Wp Cache
8 comments
page 1310
Fun With Sidebar Tabs
193 comments
page 57
Quick N Dirty Admin Login Screen
no comment
page 128
Wordpress Chat
one comment
page 1308
Wp Polls Reviewed
one comment
page 58
  updated 1 seconds ago
Monday, 6am
User links about “uninstaller” on iLinkShare

[...] | user-saved public links | iLinkShare 3 votesWordPress plugin uninstaller>> saved by asalinasci 1 days ago2 votesAshampoo UnInstaller 3.10>> saved by suburbandestiny 2 days [...]

Saturday, 8pm
What’s new and exciting? | WP FUN

[...] have already written about the plugin uninstall mechanism so I won’t go into that again but it is interesting. Back in the days of 2.3 there was a lot [...]

Thursday, 4pm
Vladimir Prelovac

I like the idea of a separate file as this will provide plugin compatibility for previous versions of WP.

Adding the option to selectively run uninstaller is not a bad idea as sometimes you want to leave the plugin on the server but do not want any traces of it in the database.