[wp-hackers] Plugins: Best practice for conditional loading of actions and file includes

Otto otto at ottodestruct.com
Mon Feb 8 16:47:15 UTC 2010


On Fri, Feb 5, 2010 at 4:20 PM, Ozh <ozh at planetozh.com> wrote:
> On Fri, Feb 5, 2010 at 9:48 PM, Otto <otto at ottodestruct.com> wrote:
>> So, best practice: Keep hooks near the functions they are hooking. If
>> you don't like the way that looks, then at least keep them in the same
>> file.
>
> I prefer grouping all the hooks at the same place instead of spreading
> them all across the file(s), because having them in one place makes it
> easier in one glance to understand the flow of things and what happens
> when.
>
> This said, I don't think the location of the hooks (near their
> functions or all grouped in one place) is a matter of "best practice"
> (assuming they're correctly declared in both case of course)

Let's just say that you're far less likely to accidentally add a hook
to an undeclared function if you have the hook and the function right
next to each other.

-Otto
Sent from Memphis, TN, United States


More information about the wp-hackers mailing list