From 01b25943c1074d21904f358e1cc3199868a13dbc Mon Sep 17 00:00:00 2001 From: TowyTowy Date: Sat, 11 Jul 2026 15:14:56 +0200 Subject: [PATCH] Fix WordPress requirement check for unavailable plugin updates When an update is present in the update API's `no_update` list with a newer version than the installed copy, `get_item_list()` derives the `update_unavailable_reason` that `wp plugin update`/`wp plugin list` surface. The WordPress-version branch compared the installed WordPress version against `$requires`, which by that point holds the *installed* plugin's own "Requires at least" header (line 972-974 fallback), and used `>=` instead of `<`. As a result the "This update requires WordPress version X" message was emitted whenever the site met the plugin's own minimum (almost always true) rather than when the site actually failed the update's WordPress requirement, producing a nonsensical reason for updates that are unavailable for other reasons (e.g. paid plugins), and hiding it when the plugin's own header exceeded the running WordPress version. Compare the running WordPress version against the update's own `requires` value with `<`, matching the correct behavior already used for themes in ParseThemeNameInput::get_all_items(). Co-Authored-By: Claude Fable 5 --- features/plugin.feature | 50 +++++++++++++++++++++++++++++++++++++++++ src/Plugin_Command.php | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/features/plugin.feature b/features/plugin.feature index ec1f1192..f40f1db2 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -1032,6 +1032,56 @@ Feature: Manage WordPress plugins """ + @require-wp-4.0 + Scenario: Do not report a WordPress requirement when the installed version already meets the update's requirement + Given a WP install + And a wp-content/plugins/example/example.php file: + """ + requires ) ? $plugin_update_info->requires : null; $items[ $file ]['requires_php'] = isset( $plugin_update_info->requires_php ) ? $plugin_update_info->requires_php : null; - if ( isset( $plugin_update_info->requires ) && version_compare( $wp_version, $requires, '>=' ) ) { + if ( isset( $plugin_update_info->requires ) && version_compare( $wp_version, $plugin_update_info->requires, '<' ) ) { $reason = "This update requires WordPress version $plugin_update_info->requires, but the version installed is $wp_version."; } elseif ( ! isset( $plugin_update_info->package ) ) { $reason = 'Update file not provided. Contact author for more details';