This returns `true` if a plugin is active for the site or, on a Multisite network, network-activated.
<?php
/**
* Checks to see if an asset is activated or not.
*
* @param string $path Path to the asset (e.g., akismet/akismet.php).
*
* @return bool true if activated, false if not.
*/
function dlx_is_plugin_activated( $path ) {
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
if ( is_multisite() ) {
if ( is_plugin_active_for_network( $path ) ) {
return true;
}
}
if ( is_plugin_active( $path ) ) {
return true;
}
return false;
}