The is_wpmu_sitewide_plugin() WordPress PHP function is a deprecated function used to determine if the current plugin is network-only.
Usage
is_wpmu_sitewide_plugin( $plugin_file );
Parameters
$plugin_file(string) – The path to the plugin file relative to the plugins directory.
More information
See WordPress Developer Resources: is_wpmu_sitewide_plugin()
This function is deprecated since version 3.0.0. Use is_network_only_plugin() instead.
Examples
Check if a plugin is network-only
// Check if the 'example-plugin' is network-only
$plugin_file = 'example-plugin/example-plugin.php';
if ( is_wpmu_sitewide_plugin( $plugin_file ) ) {
echo 'The example-plugin is network-only.';
} else {
echo 'The example-plugin is not network-only.';
}
Display a custom message for network-only plugins
// Loop through all active plugins
$active_plugins = get_option( 'active_plugins' );
foreach ( $active_plugins as $plugin ) {
if ( is_wpmu_sitewide_plugin( $plugin ) ) {
echo "The {$plugin} is network-only.";
}
}
Deactivate network-only plugins
// Loop through all active plugins
$active_plugins = get_option( 'active_plugins' );
foreach ( $active_plugins as $plugin ) {
if ( is_wpmu_sitewide_plugin( $plugin ) ) {
deactivate_plugins( $plugin );
echo "The {$plugin} has been deactivated.";
}
}
Add an admin notice for network-only plugins
add_action( 'admin_notices', 'display_network_only_plugins_notice' );
function display_network_only_plugins_notice() {
$active_plugins = get_option( 'active_plugins' );
$network_only_plugins = [];
// Check for network-only plugins
foreach ( $active_plugins as $plugin ) {
if ( is_wpmu_sitewide_plugin( $plugin ) ) {
$network_only_plugins[] = $plugin;
}
}
// Display an admin notice if any network-only plugins are active
if ( ! empty( $network_only_plugins ) ) {
$plugins_list = implode( ', ', $network_only_plugins );
echo "<div class='notice notice-warning'><p>The following plugins are network-only: {$plugins_list}</p></div>";
}
}
Log network-only plugins
// Loop through all active plugins
$active_plugins = get_option( 'active_plugins' );
$network_only_plugins = [];
// Check for network-only plugins
foreach ( $active_plugins as $plugin ) {
if ( is_wpmu_sitewide_plugin( $plugin ) ) {
$network_only_plugins[] = $plugin;
}
}
// Log network-only plugins
if ( ! empty( $network_only_plugins ) ) {
error_log( 'Network-only plugins: ' . implode( ', ', $network_only_plugins ) );
}