[wp-hackers] register_activation_hook only if is_admin() ?
Martin Widmann
widmann.martin at gmail.com
Thu Jan 27 05:57:25 UTC 2011
The register_activation_hook action is only executed when the plugin is activated through the plugins page. It's not called every time the plugin is initialized. So there's no need basically to ask for is_admin() or if the current_user_can do something special.
See also http://codex.wordpress.org/Function_Reference/register_activation_hook
- Martin
On Jan 26, 2011, at 10:34 PM, Kevin Newman wrote:
> Hello all,
>
> I'd like to know if I need to always register_activation_hook for my install routine (in a plugin), or is it ok to just register that if "is_admin()" is true (and maybe if current_user_can('manage_options')). I like to keep my overhead small.
>
> If there are cases where the activation_hook can be automatically invoked without admin or is_admin of the current user, I guess it'd have to be registered every time.
>
> Thanks,
>
> Kevin N.
>
>
> _______________________________________________
> 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