WP_Recovery_Mode::is_network_plugin() WordPress Method

The WP_Recovery_Mode::is_network_plugin() method is used to determine if a plugin is active on a network. This can be useful for plugin authors who need to know whether their plugin is active on a network in order to take appropriate action.

WP_Recovery_Mode::is_network_plugin( array $extension ) #

Checks whether the given extension a network activated plugin.


Parameters

$extension

(array)(Required)Extension data.


Top ↑

Return

(bool) True if network plugin, false otherwise.


Top ↑

Source

File: wp-includes/class-wp-recovery-mode.php

	protected function is_network_plugin( $extension ) {
		if ( 'plugin' !== $extension['type'] ) {
			return false;
		}

		if ( ! is_multisite() ) {
			return false;
		}

		$network_plugins = wp_get_active_network_plugins();

		foreach ( $network_plugins as $plugin ) {
			if ( 0 === strpos( $plugin, $extension['slug'] . '/' ) ) {
				return true;
			}
		}

		return false;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.2.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.