From 59ef20d45828229996be53ce2efc2059fed18fcd Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 2 Oct 2014 15:56:14 +0000 Subject: [PATCH] In `activate_plugin()`, do not re-run the activation routine for already-active network-wide plugins. Adds unit test. Props jbrinley. Fixes #28651. Built from https://develop.svn.wordpress.org/trunk@29818 git-svn-id: http://core.svn.wordpress.org/trunk@29584 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index bad5e9fded..d4bf57ea51 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -533,7 +533,7 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen if ( is_wp_error($valid) ) return $valid; - if ( !in_array($plugin, $current) ) { + if ( ( $network_wide && ! isset( $current[ $plugin ] ) ) || ( ! $network_wide && ! in_array( $plugin, $current ) ) ) { if ( !empty($redirect) ) wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error ob_start();