[wp-hackers] plugin loading order (rfc)
computerguru at neosmart.net
Sun Mar 11 19:30:37 GMT 2007
Won't a simple require_once() command take care of it?
Say plugins X and B require plugin M.
Plugin B loads. First line of code has a require_once for a known plugin M
It's not loaded yet, so it gets loaded as a part of this routine.
Plugin X loads. It needs plugin M, which is already loaded.
It's already loaded, nothing happens.
The only requirement is that you know the path to plugin M. But even if you
had a dependency system, you'd still have to know something about plugin M
to require it anyway.
> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-
> bounces at lists.automattic.com] On Behalf Of Peter Westwood
> Sent: Sunday, March 11, 2007 5:59 PM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] plugin loading order (rfc)
> Sabin Iacob wrote:
> > While working on a plugin, I hit an interesting issue: there is no
> > way to alter the order in which plugins are loaded than changing the
> > file name.
> This is true.
> Why do you need to change the order in which you plugin is loaded
> compared to other plugins?
> All you should be doing when you plugin is included is:
> 1. Defining functions / classes.
> 2. Defining functions to replace those in pluggable functions.
> 3. Calling add_action to add yourself to a suitable hook(s) to run
> other code on.
> The only reason why you need to get the order correct is if more than
> one plugin is trying to override the same pluggable functions - and
> you are probably not both going to work at the same time anyway.
> If you need to check for existance of other pluggins do in on the
> hook - i.e. once everyone is loaded.
> Peter Westwood
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers