[wp-trac] [WordPress Trac] #10493: Allow closures as callbacks

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 7 23:55:36 UTC 2010


#10493: Allow closures as callbacks
------------------------------+---------------------------------------------
 Reporter:  scribu            |        Owner:  scribu
     Type:  enhancement       |       Status:  closed
 Priority:  normal            |    Milestone:  3.0   
Component:  Plugins           |      Version:  2.9   
 Severity:  normal            |   Resolution:  fixed 
 Keywords:  has-patch commit  |  
------------------------------+---------------------------------------------

Comment(by scribu):

 -10.

 If you know you might need to remove it, give it a name by making it a
 regular function.

 Also, you can do this, which is equivalent to using create_function():

 {{{
 $closure = function() { // whatever }

 add_action('wp_head', $closure);

 ...

 remove_action('wp_head', $closure);
 }}}

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


More information about the wp-trac mailing list