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(): string[]
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
.
Return
string[] Array of absolute paths to files to include.
Source
File: wp-includes/ms-load.php
.
View all references
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.
&& str_ends_with( $plugin, '.php' ) // $plugin must end with '.php'.
&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist.
) {
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
}
}
return $plugins;
}
Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
If using this function, always check if multisite is enabled since ms-load.php is loaded only on multisite.