Check If Required Plugin Is Active

It might be, that your own written Plugin requires another stand alone Plugin to be active. For example if you like to offer a version with enhanced functionality of a Plugin. There are certainly a variety of usage and the implementation is not difficult.

For the implementation, we need the active Plugins, which are found in the database, table options, the active_plugins. Afterwards, I will simply look in the array, which contains the active Plugins, whether the required plugin included and active or not:

$plugins = get_option('active_plugins');
$required_plugin = 'debug_queries/debug_queries.php';
$debug_queries_on = FALSE;
if ( in_array( $required_plugin , $plugins ) ) {
	$debug_queries_on = TRUE; // Example for yes, it's active





5 responses to “Check If Required Plugin Is Active”

  1. […] muestra un interesante código que nos permite comprobar si un plugin está activo o no. Ideal para reusar código de otros plugins desde los […]

  2. […] Check If Required Plugin Is Active – Plugin, Plugins, Example, TRUE;, Afterwards, There &#8211…. […]

  3. Brad Avatar

    There is also a lesser known WP Core function to check this. I just created the Codex page so more people know about it:

  4. Guillem Avatar

    Is there a way to display an alert message on top of the plugin list into the plugin section?