From f865e91e8455a43f1cc9d53bb18f9653625e9705 Mon Sep 17 00:00:00 2001 From: shazzad Date: Tue, 17 Mar 2026 06:23:10 +0600 Subject: [PATCH] Fix false update notice when product_version is not yet set 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) --- src/Updater.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Updater.php b/src/Updater.php index b4b0987..dd41fbb 100644 --- a/src/Updater.php +++ b/src/Updater.php @@ -81,6 +81,16 @@ public function init() { */ public function pre_set_transient( $transient ) { if ( property_exists( $transient, 'checked' ) && ! empty( $transient->checked ) ) { + // Use the checked version as fallback when product_version is not yet set + // (e.g. pre_set_transient fires before the init hook). + if ( empty( $this->integration->product_version ) && isset( $transient->checked[ $this->integration->product_file ] ) ) { + $this->integration->product_version = $transient->checked[ $this->integration->product_file ]; + } + + if ( empty( $this->integration->product_version ) ) { + return $transient; + } + $response = $this->integration->client->updates(); if ( ! is_wp_error( $response ) && ! empty( $response['updates'] ) ) {