I’d like to query the database directly, and determine which plugins are enabled.
How can I do this?
I’d like to query the database directly, and determine which plugins are enabled.
How can I do this?
You can do it like this:
SELECT * FROM wp_options WHERE option_name="active_plugins";
But for better approach will be the WordPress way:
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]);
}
}