Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

wp_get_active_network_plugins() WordPress Function

The wp_get_active_network_plugins() function retrieves an array of active network plugins (plugins that are currently network-activated). This function is useful for retrieving a list of all active network plugins, or for checking if a particular plugin is active on the network. Note that this function will only return plugins that are currently active on the network; it will not return plugins that are inactive or deactivated.

wp_get_active_network_plugins() #

Returns array of network plugin files to be included in global scope.


Description

The default directory is wp-content/plugins. To change the default directory manually, define WP_PLUGIN_DIR and WP_PLUGIN_URL in wp-config.php.


Top ↑

Return

(string[]) Array of absolute paths to files to include.


Top ↑

Source

File: wp-includes/ms-load.php

function wp_get_active_network_plugins() {
	$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
	if ( empty( $active_plugins ) ) {
		return array();
	}

	$plugins        = array();
	$active_plugins = array_keys( $active_plugins );
	sort( $active_plugins );

	foreach ( $active_plugins as $plugin ) {
		if ( ! validate_file( $plugin )                     // $plugin must validate as file.
			&& '.php' === substr( $plugin, -4 )             // $plugin must end with '.php'.
			&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist.
			) {
			$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
		}
	}

	return $plugins;
}


Top ↑

Changelog

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