[wp-hackers] Leaving no trace in plugins

Michael Pretty mpretty at voceconnect.com
Mon Jun 28 03:03:57 UTC 2010


I've seen a lot of discussions on the list mentioning to leave no trace 
when your plugin is deactivated by removing any options the plugin may 
have added to the options table.  The problem with doing this is that 
users may deactivate a plugin for reasons other than removing it 
permanently; ie, they may be doing an upgrade and disable all plugins to 
prevent conflicts that may occur.  When this is the case, removing all 
of the options your plugin may have saved will cause the user's 
preferences to be lost.  Here are a couple of options I see for this:


1.  Create a delete action hook for plugins to permanently remove 
options.  The issue with this, obviously, is that the plugin wouldn't be 
running register it's delete action.  There may be a solution to this.

2.  The second suggestion would be to use the autoload field of the 
options table to create a third status that would designate that the 
option is no longer used.  Options with this new status could even be 
cleaned out every so often.

Thoughts?

Michael Pretty
prettyboymp




More information about the wp-hackers mailing list