[wp-hackers] Plugin deactivation

Mark Jaquith mark.wordpress at txfx.net
Tue Jul 5 06:26:46 GMT 2005


Robert Deaton wrote:

> While on the topic of plugins and dependancy plugins, is there any 
> chance that we can add a priority hook for plugins, so that plugins 
> that may or will have plugins that depend upon it can ensure that they 
> are loaded first, or at the very least that the dependancies can 
> specify to be loaded later on, this way no fancy hooking around init 
> or the like is required like I've been hacking to do in 1.5.

I've accomplished this by using require_once();

If plugin A needs plugin B to have been loaded first, put this at the 
top of plugin A:

require_once('plugin-a.php');

If it's already loaded, the _once part will ensure that it isn't loaded 
again.  If it isn't loaded, it'll be loaded, and then it comes time for 
it to be loaded by WP, it'll be skipped, again because of require_once().





More information about the wp-hackers mailing list