wp_get_active_network_plugins example

// Check for hacks file if the option is enabled.     if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
        _deprecated_file( 'my-hacks.php', '1.5.0' );
        array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
    }

    if ( empty( $active_plugins ) || wp_installing() ) {
        return $plugins;
    }

    $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;

    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.             // Not already included as a network plugin.             && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin$network_plugins, true ) )
        ) {
            $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
        }
    }

    

    do_action( 'mu_plugin_loaded', $mu_plugin );
}
unset( $mu_plugin$_wp_plugin_file );

// Load network activated plugins. if ( is_multisite() ) {
    foreach ( wp_get_active_network_plugins() as $network_plugin ) {
        wp_register_plugin_realpath( $network_plugin );

        $_wp_plugin_file = $network_plugin;
        include_once $network_plugin;
        $network_plugin = $_wp_plugin_file; // Avoid stomping of the $network_plugin variable in a plugin.
        /** * Fires once a single network-activated plugin has loaded. * * @since 5.1.0 * * @param string $network_plugin Full path to the plugin's main file. */

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

    /** * Stores the given error so that the extension causing it is paused. * * @since 5.2.0 * * @param array $error Error details from `error_get_last()`. * @return bool True if the error was stored successfully, false otherwise. */
Home | Imprint | This part of the site doesn't use cookies.