Skip to content

Fix false update notice when product_version is not yet set#13

Merged
shazzad merged 1 commit into
mainfrom
fix-same-version-update
Mar 17, 2026
Merged

Fix false update notice when product_version is not yet set#13
shazzad merged 1 commit into
mainfrom
fix-same-version-update

Conversation

@shazzad
Copy link
Copy Markdown
Owner

@shazzad shazzad commented Mar 17, 2026

Summary

  • product_version is only populated during the init hook, but pre_set_site_transient_update_plugins can fire earlier (e.g. during plugin activation via refresh_updates_transient/clear_updates_transient)
  • With product_version as null, version_compare('5.0.0', null, '>') always returns true, showing an update available even when the installed version matches the API version
  • Fix: fall back to the version from $transient->checked (which WordPress populates with installed versions) and bail out early when no version is available

Test plan

  • Verify plugin with version 5.0.0 no longer shows "update available" when API also reports 5.0.0
  • Verify genuine updates (API version > installed) still show correctly
  • Verify plugin activation/deactivation cycle doesn't produce false update notices

🤖 Generated with Claude Code

product_version is only populated during the init hook, but
pre_set_site_transient_update_plugins can fire earlier (e.g. during
plugin activation). With product_version null, version_compare always
returns true, showing an update even when the installed version matches.

Fall back to the version from $transient->checked and bail out early
when no version is available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shazzad shazzad merged commit d11d85b into main Mar 17, 2026
1 check passed
@shazzad shazzad deleted the fix-same-version-update branch March 17, 2026 00:24
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