[wp-trac] [WordPress Trac] #12754: register_uninstall_hook() doesn't allow multiple callbacks

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 29 07:33:39 UTC 2010


#12754: register_uninstall_hook() doesn't allow multiple callbacks
--------------------------+-------------------------------------------------
 Reporter:  scribu        |       Owner:  westi    
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  3.0      
Component:  Plugins       |     Version:  3.0      
 Severity:  normal        |    Keywords:  has-patch
--------------------------+-------------------------------------------------
Changes (by scribu):

  * keywords:  => has-patch


Comment:

 Replying to [comment:3 nacin]:
 > This wouldn't work when the plugin is deactivated at the time of the
 uninstallation.

 After applying the patch, please activate the example plugin, deactivate
 it and then uninstall it.

 You will see that it does, in fact, work.


 > 1) register_uninstall_hook() would need to be run in global scope.

 I don't see what scope has to do with this.

 > 2) The callback would need to be in the same file as the call to
 register_uninstall_hook().

 Unlike with the uninstall.php method, the main plugin file is loaded
 before the hook is fired.

 So, as long as the plugin includes the file with the callback(s), it
 doesn't matter where they are.

 It's really not that different from register_deactivation_hook().

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12754#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list