WP_Recovery_Mode::is_network_plugin()protectedWP 5.2.0

Checks whether the given extension a network activated plugin.

Method of the class: WP_Recovery_Mode{}

No Hooks.

Return

true|false. True if network plugin, false otherwise.

Usage

// protected - for code of main (parent) or child class
$result = $this->is_network_plugin( $extension );
$extension(array) (required)
Extension data.

Changelog

Since 5.2.0 Introduced.

WP_Recovery_Mode::is_network_plugin() code WP 6.5.2

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 ( str_starts_with( $plugin, $extension['slug'] . '/' ) ) {
			return true;
		}
	}

	return false;
}