[wp-hackers] Prioritizing Function Hooks

Mihai Chereji mihai.chereji at gmail.com
Wed Dec 7 15:56:12 UTC 2011


On Wed 07 Dec 2011 05:47:35 PM EET, Alison Foxall wrote:
> Hey All,
>
> I'm just starting out developing plugins and such had a question. How would
> you prioritize a function hook when the particular hook is used by multiple
> plugins?  e.g.
>
> Plugin One:
>
> add_action ("pre_user_query", "plugin_one_pre_user_query");
>
> Plugin Two:
>
> add_action ("pre_user_query", "plugin_two_pre_user_query");
>
>
>
> Thanks in advance!
>
> -A
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

As the Codex states 
(http://codex.wordpress.org/Function_Reference/add_action), add_action 
accepts a 3rd optional parameter, called $priority, which defaults to 
10.

Perhaps counter-intuitively, the lower you set your priority, the 
earlier the action will be triggered.

-- 
-- Mihai Chereji


More information about the wp-hackers mailing list