Skip to content
10 changes: 9 additions & 1 deletion src/wp-admin/includes/class-wp-plugin-install-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,15 @@ public function display_rows() {
$incompatible_notice_message .= wp_update_php_annotation( '</p><p><em>', '</em>', 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. */
Expand Down
10 changes: 9 additions & 1 deletion src/wp-admin/includes/plugin-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,15 @@ function install_plugin_information() {
)
);
} elseif ( ! $compatible_wp ) {
$compatible_wp_notice_message = __( '<strong>Error:</strong> This plugin <strong>requires a newer version of WordPress</strong>.' );
if ( ! empty( $requires_wp ) ) {
Comment thread
kipmyk marked this conversation as resolved.
$compatible_wp_notice_message = sprintf(
/* translators: %s: Minimum required WordPress version. */
__( '<strong>Error:</strong> This plugin <strong>requires WordPress %s or higher</strong>.' ),
esc_html( $requires_wp )
);
} else {
$compatible_wp_notice_message = __( '<strong>Error:</strong> This plugin <strong>requires a newer version of WordPress</strong>.' );
}
if ( current_user_can( 'update_core' ) ) {
$compatible_wp_notice_message .= sprintf(
/* translators: %s: URL to WordPress Updates screen. */
Expand Down
31 changes: 31 additions & 0 deletions tests/phpunit/tests/admin/wpPluginInstallListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
}

Expand All @@ -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 );
}
}
Loading