Programmatically Checking if a WordPress Plugin is Installed

When writing a WordPress plugin, it can sometimes be helpful to tell if another plugin is active or not, whether to prevent conflicts or to extend another plugin that you require as a dependency.

Fortunately, there’s a conditional function built into WordPress for just this task.

if ( is_plugin_active('the-plugin/the-plugin.php') ) {
 //do stuff
}

The is_plugin_active() function accepts the relative path to the plugin (from the wp-content/plugins directory) as an argument, and returns either TRUE or FALSE.

Leave a Reply