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

WordPress Trac wp-trac at lists.automattic.com
Fri May 7 22:43:14 UTC 2010


#12754: register_uninstall_hook() doesn't allow multiple callbacks
-------------------------+--------------------------------------------------
 Reporter:  scribu       |       Owner:  westi         
     Type:  enhancement  |      Status:  new           
 Priority:  normal       |   Milestone:  Future Release
Component:  Plugins      |     Version:  3.0           
 Severity:  normal       |    Keywords:  needs-patch   
-------------------------+--------------------------------------------------

Comment(by jacobsantos):

 For what it is worth, I think this should be closed as won't fix.

 If you wish to run two functions at uninstall, then just call the second
 from the uninstall hook. There was never envisioned a need for running two
 hooks at once, because we wouldn't include two files at once either.

 I mean, not be harsh, but really, the power of programming is to call
 functions within functions.

 {{{
 <?php
 function example_install() {
         add_option('example_option_a', 'foo');
         add_option('example_option_b', 'bar');
         example_uninstall_a();
         example_uninstall_b();
 }
 register_activation_hook(__FILE__, 'example_install');

 function example_uninstall_a() {
         delete_option('example_option_a');
 }

 function example_uninstall_b() {
         delete_option('example_option_b');
 }
 ?>
 }}}

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


More information about the wp-trac mailing list