[wp-hackers] plugin loading order (rfc)

Peter Westwood peter.westwood at ftwr.co.uk
Sun Mar 11 15:58:44 GMT 2007

Sabin Iacob wrote:
> While working on a plugin, I hit an interesting issue: there is no other 
> 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 then 
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 "init" 
hook - i.e. once everyone is loaded.

Peter Westwood

More information about the wp-hackers mailing list