diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php index 7c54aefca1310..64a69c0f8ae8b 100644 --- a/src/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -636,7 +636,15 @@ public function display_rows() { $incompatible_notice_message .= wp_update_php_annotation( '

', '', false ); } } elseif ( ! $compatible_wp ) { - $incompatible_notice_message .= __( 'This plugin does not work with your version of WordPress.' ); + if ( ! empty( $requires_wp ) ) { + $incompatible_notice_message .= sprintf( + /* translators: %s: Minimum required WordPress version. */ + __( 'This plugin requires WordPress %s or higher.' ), + esc_html( $requires_wp ) + ); + } else { + $incompatible_notice_message .= __( 'This plugin does not work with your version of WordPress.' ); + } if ( current_user_can( 'update_core' ) ) { $incompatible_notice_message .= sprintf( /* translators: %s: URL to WordPress Updates screen. */ diff --git a/src/wp-admin/includes/plugin-install.php b/src/wp-admin/includes/plugin-install.php index dc232f1df7018..f71cae6dbcb03 100644 --- a/src/wp-admin/includes/plugin-install.php +++ b/src/wp-admin/includes/plugin-install.php @@ -836,7 +836,15 @@ function install_plugin_information() { ) ); } elseif ( ! $compatible_wp ) { - $compatible_wp_notice_message = __( 'Error: This plugin requires a newer version of WordPress.' ); + if ( ! empty( $requires_wp ) ) { + $compatible_wp_notice_message = sprintf( + /* translators: %s: Minimum required WordPress version. */ + __( 'Error: This plugin requires WordPress %s or higher.' ), + esc_html( $requires_wp ) + ); + } else { + $compatible_wp_notice_message = __( 'Error: This plugin requires a newer version of WordPress.' ); + } if ( current_user_can( 'update_core' ) ) { $compatible_wp_notice_message .= sprintf( /* translators: %s: URL to WordPress Updates screen. */ diff --git a/tests/phpunit/tests/admin/wpPluginInstallListTable.php b/tests/phpunit/tests/admin/wpPluginInstallListTable.php index 406c740a443f3..00a8fbb73c1e6 100644 --- a/tests/phpunit/tests/admin/wpPluginInstallListTable.php +++ b/tests/phpunit/tests/admin/wpPluginInstallListTable.php @@ -13,6 +13,7 @@ class Tests_Admin_wpPluginInstallListTable extends WP_UnitTestCase { public function set_up() { parent::set_up(); + require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; $this->table = _get_list_table( 'WP_Plugin_Install_List_Table', array( 'screen' => 'plugin-install' ) ); } @@ -24,4 +25,34 @@ public function set_up() { public function test_get_views_should_return_no_views_by_default() { $this->assertSame( array(), $this->table->get_views() ); } + + /** + * @ticket 61211 + * + * @covers WP_Plugin_Install_List_Table::display_rows + */ + public function test_display_rows_incompatible_wp_displays_required_version() { + $this->table->items = array( + array( + 'slug' => 'incompatible-test-plugin', + 'name' => 'Incompatible Test Plugin', + 'version' => '1.0.0', + 'author' => 'Test Author', + 'requires' => '99.0', + 'requires_php' => '7.0', + 'last_updated' => '2026-01-01 00:00:00', + 'icons' => array( 'default' => 'http://example.org/icon.png' ), + 'short_description' => 'A test plugin.', + 'rating' => 100, + 'num_ratings' => 1, + 'active_installs' => 1000, + ), + ); + + ob_start(); + $this->table->display_rows(); + $output = ob_get_clean(); + + $this->assertStringContainsString( 'This plugin requires WordPress 99.0 or higher.', $output ); + } }