I’d like to query the database directly, and determine which plugins are enabled.

How can I do this?

3 Answers
3

You can do it like this:

SQL

SELECT * FROM wp_options WHERE option_name="active_plugins";

But for better approach will be the WordPress way:

WordPress

if ( ! function_exists( 'get_plugins' ) ) {
    require_once ABSPATH . 'wp-admin/includes/plugin.php';
}

$active_plugins = get_option('active_plugins');
$all_plugins = get_plugins();
$activated_plugins = array();

foreach ($active_plugins as $plugin){           
    if(isset($all_plugins[$plugin])){
         array_push($activated_plugins, $all_plugins[$plugin]);
    }           
}

Leave a Reply

Your email address will not be published. Required fields are marked *