Quantcast
Viewing all articles
Browse latest Browse all 11

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
}

© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)

Viewing all articles
Browse latest Browse all 11

Trending Articles