[wp-hackers] register_activation_hook and PHP closure
Eric Mann
eric at eam.me
Wed Apr 25 15:58:30 UTC 2012
Just for the record, registering hooks using closures is typically a bad
idea because they can't be removed later with `remove_action()`.
On Wed, Apr 25, 2012 at 5:08 AM, Ryan Chan <ryanchan404 at gmail.com> wrote:
> Seems register_activation_hook not support closure but not throwing out
> error?
>
> e.g.
>
> register_activation_hook(__FILE__, function() {
> update_option('myplugin_activated', 1);
> });
>
>
> However, register_uninstall_hook do throw out that closure cannot be
> serialized error if I use closure.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list