[wp-hackers] Leaving no trace in plugins

Stephen Rider wp-hackers at striderweb.com
Mon Jun 28 12:07:29 UTC 2010


To consolidate the other two responses:

There are two things already implemented, register_uninstall_hook() and uninstall.php.

The first hook registers code to run when a plugin is deleted (not deactivated) through the plugins page GUI.

Second, if your plugin directory contains an uninstall.php file, it will be loaded when your plugin is deleted.

Two different ways of doing the same thing, basically.

Some plugins do (incorrectly, IMO) remove their own data when deactivated, but this is not official best practice.

Stephen

On Jun 27, 2010, at 10:03 PM, Michael Pretty wrote:

> 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


More information about the wp-hackers mailing list