Skip to content

Commit 62645be

Browse files
committed
Site Health: Disable recommendations that could be problematic on multisite installs.
When viewing Site Health for a multisite install, there are a few recommendations that are not appropriate and could have negative implications for other sites on the install if the administrator follows the advice provided. For example, Site Health recommends that inactive plugins and themes for a site should be removed. On a single site install, this is a great recommendation. However, on a multisite install, inactive plugins and themes for one site should not be removed because they could be active for other sites on the network. This change also disables the `test_wp_version_check_attached()` test for multisite. This test checks for the presence of the `wp_version_check()` function on the `wp_version_check` hook, which is not present for every site on multisite. Reviewed by jeremyfelt and desrosj. Props iandunn, Clorith, azaozz, jeremyfelt. Fixes #47084. git-svn-id: https://develop.svn.wordpress.org/trunk@45275 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a8942b4 commit 62645be

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/wp-admin/includes/class-wp-site-health-auto-updates.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public function test_constants( $constant, $value ) {
8686
* @return array The test results.
8787
*/
8888
public function test_wp_version_check_attached() {
89+
if ( ! is_main_site() ) {
90+
return;
91+
}
92+
8993
$cookies = wp_unslash( $_COOKIE );
9094
$timeout = 10;
9195
$headers = array(

src/wp-admin/includes/class-wp-site-health.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public function get_test_plugin_version() {
366366
}
367367

368368
// Check if there are inactive plugins.
369-
if ( $plugins_total > $plugins_active ) {
369+
if ( $plugins_total > $plugins_active && ! is_multisite() ) {
370370
$unused_plugins = $plugins_total - $plugins_active;
371371

372372
$result['status'] = 'recommended';
@@ -521,7 +521,7 @@ public function get_test_theme_version() {
521521
}
522522
}
523523

524-
if ( $has_unused_themes && $show_unused_themes ) {
524+
if ( $has_unused_themes && $show_unused_themes && ! is_multisite() ) {
525525

526526
// This is a child theme, so we want to be a bit more explicit in our messages.
527527
if ( $active_theme->parent() ) {

0 commit comments

Comments
 (0)