888888.888888.88""Yb..dP"Yb..8888b..Yb..dP.88b.88....db....8b....d8.88..dP""b8..dP"Y8
88__...88__...88__dP.dP...Yb..8I..Yb.YbdP..88Yb88...dPYb...88b..d88.88.dP...`".`Ybo."
88""...88""...88"Yb..Yb...dP..8I..dY..8P...88.Y88..dP__Yb..88YbdP88.88.Yb......o.`Y8b
88.....888888.88..Yb..YbodP..8888Y"..dP....88..Y8.dP""""Yb.88.YY.88.88..YboodP.8bodP'


88b.88.888888.888888.Yb........dP.dP"Yb..88""Yb.88..dP
88Yb88.88__.....88....Yb..db..dP.dP...Yb.88__dP.88odP.
88.Y88.88"".....88.....YbdPYbdP..Yb...dP.88"Yb..88"Yb.
88..Y8.888888...88......YP..YP....YbodP..88..Yb.88..Yb

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.

Html 5 Gallery
Wordpress html 5?
6 comments
page 1305
Post Image The Easy Peasy Way
Wordpress link to large image?
26 comments
page 1065
Wordpress Shortcodes What Why How
Create gallery shortcode wordpres?
no comment
page 236
Post Image The Easy Peasy Way
Vivieneasy url?
26 comments
page 1065
Are Child Themes The Best Option
Best thematic childthemes?
15 comments
page 1262
How To Add Sidebars To A Theme
Add a dynamic sidebar area to thematic?
10 comments
page 1053
Theming Habari Vs Wordpress
Habari vs wordpress?
13 comments
page 440
Dont Mess With My Toot Toot
Fun with toots?
16 comments
page 599
Dont Mess With My Toot Toot
Fun with toots?
16 comments
page 599
Wordpress 25 Exif Fields
Display image from wordpress database?
12 comments
page 230
Html 5 Gallery
Html5 photo album?
6 comments
page 1305
Dont Mess With My Toot Toot
Fun with toots?
16 comments
page 599
Dont Mess With My Toot Toot
Fun with toots?
16 comments
page 599
Photoshop Design Framework
Framework for photoshop?
3 comments
page 296
Using Wordpress As A Php Framework
Php framework with wordpress?
2 comments
page 335
Post Image The Easy Peasy Way
Adding image in my post in wordpress?
26 comments
page 1065
Wpunlimited The Ultimate Wordpress Theme
Html5 photo album?
3 comments
page 1141
Html 5 Gallery
Photo gallery html 5?
6 comments
page 1305
Html 5 Gallery
Photo gallery html5?
6 comments
page 1305
Html 5 Gallery
Make gallery html5?
6 comments
page 1305
3 Ways To Speed Up Your Blog Without A Cache Plugin
How to speed up wordpress without using cache?
one comment
page 1321
Wordpress 25 Exif Fields
Wordpress exif plugin?
12 comments
page 230
Fun With Sidebar Tabs Styling
Tabbed widget plugin change background color?
2 comments
page 336
Html 5 Gallery
Html5 wordpress?
6 comments
page 1305
Quick N Dirty Admin Login Screen
Login screen css?
no comment
page 128
Post Image The Easy Peasy Way
Display first image from post loop wordpress?
26 comments
page 1065
Html 5 Gallery
Html5 image gallery?
6 comments
page 1305
Post Image The Easy Peasy Way
Get image link de medium wordpress?
26 comments
page 1065
Html 5 Gallery
Html5 photo gallery?
6 comments
page 1305
Wltc Plugin Competition Live Blogging Plugin
Wordpress liveblogging plugin?
2 comments
page 1258
Html 5 Gallery
Html gallery?
6 comments
page 1305
Using Your Own Url Shortener
Create your own url shortener in php?
4 comments
page 1190
Updating Code Snippets Here
Fun plugin wordpress?
no comment
page 1338
  1 query every 1064 seconds, 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.