is_network_only_plugin( string $plugin )
Checks for “Network: true” in the plugin header to see if this should be activated only as a network wide plugin. The plugin would also work when Multisite is not enabled.
Description
Checks for "Site Wide Only: true" for backward compatibility.
Parameters
- $plugin
-
(string) (Required) Path to the plugin file. Accepts a path relative to the plugins directory, or an absolute path, with or without surrounding whitespace.
Return
(bool) True if plugin is network only, false otherwise.
Source
File: wp-admin/includes/plugin.php
function is_network_only_plugin( $plugin ) {
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
if ( $plugin_data )
return $plugin_data['Network'];
return false;
}
Changelog
| Version | Description |
|---|---|
| 7.1.1 | The $plugin path is normalized with plugin_basename() and trim(), matching how activate_plugin() resolves it. |
| 3.0.0 | Introduced. |