is_network_only_plugin() WordPress Function

The is_network_only_plugin() function is used to check if a plugin is active for the network. This function is only available in WordPress 3.0 and above.

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.


Top ↑

Parameters

$plugin

(string)(Required)Path to the plugin file relative to the plugins directory.


Top ↑

Return

(bool) True if plugin is network only, false otherwise.


Top ↑

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;
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.