Skip to content

Site Health: Demonstrate the version check test never reporting on multisite - #15953

Draft
desrosj wants to merge 1 commit into
WordPress:trunkfrom
desrosj:test/site-health-ms-version-check
Draft

desrosj wants to merge 1 commit into
WordPress:trunkfrom
desrosj:test/site-health-ms-version-check

Conversation

@desrosj

@desrosj desrosj commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Adds tests showing that Site Health never reports a plugin removing wp_version_check() from its hook on multisite.

WP_Site_Health_Auto_Updates::test_wp_version_check_attached() reports the problem when this condition is true:

( ! is_multisite() || is_main_site() && is_network_admin() )
	&& ! has_filter( 'wp_version_check', 'wp_version_check' )

The is_main_site() part was added in r50035 (#52135). wp-includes/update.php only adds the hook on the main site, so every other site in a network got a false "A plugin has prevented updates by disabling wp_version_check()" error. The condition also requires is_network_admin(), though. Site Health has no network admin screen, and the background updates test runs through the REST API (wp-site-health/v1/tests/background-updates), where is_network_admin() is false. So on multisite, the test never reports anything, even on the main site.

Tests:

  • test_wp_version_check_attached_should_report_removed_check() (ms-excluded, passes): the single site baseline.
  • test_wp_version_check_attached_should_report_removed_check_on_main_site() (ms-required, fails): on the main site, outside the network admin, the test returns null instead of a failure.
  • test_wp_version_check_attached_should_not_report_on_other_sites() (ms-required, passes): keeps the #52135 fix in place for sites other than the main site.
npm run test:php -- --filter test_wp_version_check_attached
npm run test:php -- -c tests/phpunit/multisite.xml --filter test_wp_version_check_attached

Tests only. Changing the condition to ( ! is_multisite() || is_main_site() ) makes all three pass. I tried that locally but haven't included it here.

Trac ticket: Core-66682.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Tracing the condition back to #52135, and drafting the tests and this description. To be reviewed by me.

🤖 Generated with Claude Code


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

`WP_Site_Health_Auto_Updates::test_wp_version_check_attached()` reports a plugin removing `wp_version_check()` from its hook. On multisite, [50035] limited it to the main site, because wp-includes/update.php only adds the hook there. The condition also requires `is_network_admin()`, but Site Health has no network admin screen, and the background updates test runs through the REST API, so the test never reports a problem on multisite.

The single site baseline and the test for other sites pass. The main site test fails.

See #52135.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant