is_plugin_active_for_network

Check whether the plugin is active for the entire network.

Description

is_plugin_active_for_network( (string) $plugin ); 

Only plugins installed in the plugins/ folder can be active.

Plugins in the mu-plugins/ folder can't be activated, so this function will return false for those plugins.

Parameters (1)

0. $plugin (string)
Base plugin path from plugins directory.

Usage

  1. if ( !function_exists( 'is_plugin_active_for_network' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/plugin.php'; 
  3.  
  4. // Base plugin path from plugins directory. 
  5. $plugin = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = is_plugin_active_for_network($plugin); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/plugin.php  
  1. function is_plugin_active_for_network( $plugin ) { 
  2. if ( !is_multisite() ) 
  3. return false; 
  4.  
  5. $plugins = get_site_option( 'active_sitewide_plugins'); 
  6. if ( isset($plugins[$plugin]) ) 
  7. return true; 
  8.  
  9. return false;