post-page

WordPress 2.7 Plugin Uninstall Methods

5
responses
heading
heading
heading
5
Responses

 

Comments

  1. Jacob Santos says:

    To put the quote in context, if you use the uninstall.php method, then you don’t have to worry about plugins which use their main plugin file to “bootstrap” other parts of code. The plugin is running code outside of functions, which WordPress has no control over. The plugin is deactivated, and in order to run the uninstall hook, the plugin has to be included for a short time in order to run that code.

    Some plugins might assume that since they are being included that they should check whether their option exists or do other strange tasks that belong in functions or the activation hook. In other words, they think they are being activated, when they are actually bein uninstalled.

    Special care also has to be made with the uninstall.php file to make sure that some interested party doesn’t stumble upon the uninstall.php file and then have it launch into the uninstall process. There are two constants that can be checked to ensure that event doesn’t happen.

    Hey, thanks for the link by the way. It should make its way into the codex once 2.7 is released and the feature is still in there.

  2. GaMerZ (31 comments.) says:

    I think the uninstall API can be improved before I switch from my own plugin uninstaller to the WP plugin uninstaller as I think my own uninstaller has more user forgiveness and tells the user what options or tables are going to be deleted.

  3. Stephen Cronin (30 comments.) says:

    I haven’t looked at the 2.7 uninstall api yet, but I’d like to say that the uninstall function that Lester includes in his plugins is top notch. I’ve been meaning to add something like that to my plugins. I guess I’ll try out the API method, but if Lester thinks it can be improved, he should be listened to!

  4. GaMerZ (31 comments.) says:

    @Stephen Thanks so much for the kind compliments =)

  5. Jacob Santos says:

    The uninstaller only runs during the delete process, therefore it should be assumed that the user doesn’t want to use your plugin any more. From that, you can assume that everything should go, including all tables, options, and files that were created by the plugin.



Obviously Powered by WordPress. © 2003-2013

page counter
css.php