[wp-hackers] Plugin Activation Check

Mark Jaquith mark.wordpress at txfx.net
Thu Jul 7 20:04:32 GMT 2005


Scott Merrill wrote:

>Bill Smith wrote:
>  
>
>>I have a plugin that is dependent on another plugin. Is there a straight
>>forward way to check to see if a plugin is installed and active?
>>    
>>
>
>The most basic method is for plugin B to perform:
>if (! function_exists('plugin_A_function')) {
>   return;
>}
>
>  
>
You can even get fancy with file_exists() and require_once() to find out 
if it is installed and require_once() it if it is.  Sometimes it's 
installed and active, but the plugins aren't loading in the order you'd 
like.  This will change that.

Be aware, though, that it's best not to run code as the plugin is 
included.  It's much better to create functions or classes and to 
include a "hook" to the "init" or "plugins_loaded" actions.  That way, 
all plugins that are active will have declared all their functions and 
you won't have to worry about loading order.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/wp-hackers/attachments/20050707/54235be0/attachment.html


More information about the wp-hackers mailing list