[wp-hackers] register_activation_hook and PHP closure

Ryan McCue lists at rotorised.com
Thu Apr 26 10:50:08 UTC 2012

Lionel POINTET wrote:
> You should maybe take into account that everybody doesn't have PHP>= 5.3
> and that methods will break with the older platforms...

Also important to note: it will most likely not work with 
create_function() either, as the internal function created changes its 
name each request.

(Might be worth testing though)

I agree that anonymous functions/closures can be much nicer, but I'd 
avoid using them for activation/deactivation anyway. Those should be 
named methods in your class instead, IMHO.

(I use anonymous functions/closures for a lot of quick hooks, and for 
array_map/array_filter calls personally, but anything more than a few 
lines I move into a proper function/method.)

Ryan McCue

More information about the wp-hackers mailing list