Post Pic

Check if a WordPress plugin is active, the easy way

When working with lots and lots of plugins, it can be useful for developers to be able to check if a particular WordPress plugin is active or not. Just read this recipe to find out.

If you want to check if a WordPress plugin is active, just use the is_plugin_active() function. The function takes a single parameter, which is the path to the plugin, as shown in the example below:

<?php
if (is_plugin_active('plugin-directory/plugin-file.php')) {
    //plugin is activated
}
?>

10 Responses

Sep 21 2009 09:53

Wow… “The” easy way. Nice to know that, because sometimes my themes depends of plugins, so with this I can warning my users.
Thanks a lot!

Sep 21 2009 13:32

Wow, that really is easy :D I tend to check for the existence of the functions I use in case the plugin gets updated and the function names changed.

Sep 21 2009 14:49

Since you can’t be sure about the path to the main plugin-file, I consider checking via “function_exists()” or “class_exists()” much more reliable.

Sep 21 2009 15:05

Thanks for the tip..Your tip are small but very useful..Retweeted it

Sep 21 2009 21:14

Thanks for this simple yet very useful recipe. I don’t like to overload my blog with too many plug-ins but this tip would certainly be helpful in maintaining them.

Oct 12 2009 12:38

Nice Tip!

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required