WordPress tip: Check whether a plugin is active

July 9, 2013 at 10:05 pm

When developing a WordPress theme or plugin, it can be really useful to be able to know if a specific plugin is activated. Here is a simple way to check wheher a plugin is activated or not.

Just paste the code below in your theme file, wherever you’d like to check out if a plugin is activated or not. Update the code with the plugin directory and name on line 4.

<?php 
   include_once( ABSPATH . 'wp-admin/includes/plugin.php' );

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

Thanks to Jean galea for this brillant tip!