[wp-hackers] Plugin dependency checking

Austin Matzko if.website at gmail.com
Fri Jun 12 23:38:53 GMT 2009


On Fri, Jun 12, 2009 at 5:28 PM, <wp-hackers at striderweb.com> wrote:
> The earliest hook you can use after plugins load is "plugins_loaded".
> Unfortunately, the plugins_loaded hook is NOT the first thing that happens
> after plugins are loaded.  First pluggable.php is called, then some
> caching stuff happens.
>
> So if your plugin wants to replace any of the pluggable.php functions, it
> MUST do so immediately -- it can't run later on a do_action.

I'm not sure why "plugins_loaded" is called at that point, but I think
that's a separate issue from having dependent plugins.  You can define
a pluggable function when the plugin is loaded, without having to
initialize the plugin itself.

If it's a matter of wanting the child plugins to be able to redefine
the pluggable function, you could let the parent plugin define the
pluggable function as a wrapper of a parent plugin's factory method,
which would then open up the possibility of child plugins re-defining
the behavior of the pluggable function.


More information about the wp-hackers mailing list