From eed75b29b026e8a39965dd8f6376b25e15f702fe Mon Sep 17 00:00:00 2001 From: AKSHAT2802 Date: Tue, 2 Dec 2025 02:19:41 +0530 Subject: [PATCH 01/11] feat: Enhance compatibility checks for plugins with tested upto WordPress version --- .../includes/class-wp-plugins-list-table.php | 163 +++++++++++++++++- src/wp-includes/functions.php | 35 +++- 2 files changed, 196 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 897e46cda22d2..7bead4712a3e6 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -150,12 +150,30 @@ public function prepare_items() { $plugins['dropins'] = get_dropins(); } + /** + * REPLACE WITH (or ADD AFTER the above code): + */ if ( current_user_can( 'update_plugins' ) ) { $current = get_site_transient( 'update_plugins' ); + // echo '
';
+				// echo print_r( $current->response, true );
+				// echo '
'; foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { + // Check if plugin has an available update. if ( isset( $current->response[ $plugin_file ] ) ) { + $plugins['all'][ $plugin_file ]['update'] = true; $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; + + // Merge additional API data from update response. + // This includes: slug, tested, requires, requires_php, etc. + $api_data = (array) $current->response[ $plugin_file ]; + $plugins['all'][ $plugin_file ] = array_merge( $plugins['all'][ $plugin_file ], $api_data ); + + } elseif ( isset( $current->no_update[ $plugin_file ] ) ) { + // Plugin is up-to-date, but we still want API data (tested, requires, etc.) + $api_data = (array) $current->no_update[ $plugin_file ]; + $plugins['all'][ $plugin_file ] = array_merge( $plugins['all'][ $plugin_file ], $api_data ); } } } @@ -454,7 +472,8 @@ public function search_box( $text, $input_id ) { ?> $plugin_slug, + 'fields' => array( + 'sections' => false, + 'rating' => false, + 'downloaded' => false, + 'last_updated' => false, + 'banners' => false, + 'icons' => false, + 'active_installs' => false, + 'short_description' => false, + 'tags' => false, + 'compatibility' => false, + 'contributors' => false, + 'ratings' => false, + 'screenshots' => false, + 'support_url' => false, + 'added' => false, + 'homepage' => false, + 'download_link' => false, + 'upgrade_notice' => false, + 'versions' => false, + 'business_model' => false, + 'repository_url' => false, + 'commercial_support_url' => false, + 'donate_link' => false, + 'preview_link' => false, + ) + ) + ); + + $tested_wp = null; + $tested_compatible = true; + + if ( ! is_wp_error( $plugin_information ) && isset( $plugin_information->tested ) ) { + $tested_wp = $plugin_information->tested; + } + + if ( null !== $tested_wp ) { + $tested_compatible = is_tested_wp_version_compatible( $tested_wp ); + } + $has_dependents = WP_Plugin_Dependencies::has_dependents( $plugin_file ); $has_active_dependents = WP_Plugin_Dependencies::has_active_dependents( $plugin_file ); $has_unmet_dependencies = WP_Plugin_Dependencies::has_unmet_dependencies( $plugin_file ); @@ -1510,6 +1577,100 @@ public function single_row( $item ) { * 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'. */ do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status ); + + if ( ! $tested_compatible ) { + global $wp_version; + $show_compat_warning = true; + $compat_message = sprintf( + /* translators: 1: Current WordPress version, 2: Version the plugin was tested up to. */ + __( 'This plugin has not been tested with your current version of WordPress (%1$s). It may still work, but consider checking for an update or contacting the plugin author. Last tested with WordPress %2$s.' ), + $wp_version, + $tested_wp, + ); + + /** + * Filters whether to show compatibility warning for a plugin. + * + * @since 6.8.0 + * + * @param bool $show_compat_warning Whether to show the compatibility warning. + * @param string $plugin_file Path to the plugin file relative to the plugins directory. + * @param array $plugin_data An array of plugin data. See get_plugin_data() + * and the {@see 'plugin_row_meta'} filter for the list + * of possible values. + * @param string $tested_wp The WordPress version the plugin was tested up to. + * @param string $wp_version Current WordPress version. + */ + $show_compat_warning = apply_filters( + 'show_plugin_compatibility_warning', + $show_compat_warning, + $plugin_file, + $plugin_data, + $tested_wp, + $wp_version + ); + + /** + * Filters the compatibility warning message for a plugin. + * + * @since 6.8.0 + * + * @param string $compat_message The compatibility warning message. + * @param string $plugin_file Path to the plugin file relative to the plugins directory. + * @param array $plugin_data An array of plugin data. See get_plugin_data() + * and the {@see 'plugin_row_meta'} filter for the list + * of possible values. + * @param string $tested_wp The WordPress version the plugin was tested up to. + * @param string $wp_version Current WordPress version. + */ + $compat_message = apply_filters( + 'plugin_compatibility_warning_message', + $compat_message, + $plugin_file, + $plugin_data, + $tested_wp, + $wp_version + ); + + if ( $show_compat_warning && ! empty( $compat_message ) ) { + printf( + '', + $is_active ? ' active' : ' inactive', + esc_attr( $plugin_slug . '-compat-warning' ), + esc_attr( $plugin_slug ), + esc_attr( $plugin_file ), + esc_attr( $this->get_column_count() ) + ); + + $details_url = ''; + $details_link = ''; + + if ( current_user_can( 'install_plugins' ) ) { + $details_url = network_admin_url( + 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . + '&TB_iframe=true&width=600&height=550' + ); + + $details_link = sprintf( + ' %s', + esc_url( $details_url ), + /* translators: %s: Plugin name. */ + esc_attr( sprintf( __( 'More information about %s' ), $plugin_data['Name'] ) ), + __( 'View details' ) + ); + } + + wp_admin_notice( + $compat_message . $details_link, + array( + 'type' => 'warning', + 'additional_classes' => array( 'notice-alt', 'inline' ), + ) + ); + + echo ''; + } + } } /** diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 68a29f444fd48..96bb5d9f8c50c 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -8971,10 +8971,43 @@ function is_wp_version_compatible( $required ) { $required = substr( $trimmed, 0, -2 ); } } - return empty( $required ) || version_compare( $version, $required, '>=' ); } +/** + * Checks compatibility with the tested WordPress version. + * + * @since 6.9.0 + * + * @global string $_wp_tests_wp_version The WordPress version string. Used only in Core tests. + * + * @param string $required Maximum required WordPress version. + * @return bool True if required version is compatible, false if not. + */ +function is_tested_wp_version_compatible( $required ) { + if ( + defined( 'WP_RUN_CORE_TESTS' ) + && WP_RUN_CORE_TESTS + && isset( $GLOBALS['_wp_tests_wp_version'] ) + ) { + $wp_version = $GLOBALS['_wp_tests_wp_version']; + } else { + $wp_version = wp_get_wp_version(); + } + + // Strip off any -alpha, -RC, -beta, -src suffixes. + list( $version ) = explode( '-', $wp_version ); + + if ( is_string( $required ) ) { + $trimmed = trim( $required ); + + if ( substr_count( $trimmed, '.' ) > 1 && str_ends_with( $trimmed, '.0' ) ) { + $required = substr( $trimmed, 0, -2 ); + } + } + return version_compare( $version, $required, '<=' ); +} + /** * Checks compatibility with the current PHP version. * From 544b8395435bf229f758a5f2025e75defc857431 Mon Sep 17 00:00:00 2001 From: AKSHAT2802 Date: Tue, 2 Dec 2025 10:22:04 +0530 Subject: [PATCH 02/11] fix: phpcs and remove debug code --- .../includes/class-wp-plugins-list-table.php | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 7bead4712a3e6..35d1864d1f377 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -150,30 +150,12 @@ public function prepare_items() { $plugins['dropins'] = get_dropins(); } - /** - * REPLACE WITH (or ADD AFTER the above code): - */ if ( current_user_can( 'update_plugins' ) ) { $current = get_site_transient( 'update_plugins' ); - // echo '
';
-				// echo print_r( $current->response, true );
-				// echo '
'; foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { - // Check if plugin has an available update. if ( isset( $current->response[ $plugin_file ] ) ) { - $plugins['all'][ $plugin_file ]['update'] = true; $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; - - // Merge additional API data from update response. - // This includes: slug, tested, requires, requires_php, etc. - $api_data = (array) $current->response[ $plugin_file ]; - $plugins['all'][ $plugin_file ] = array_merge( $plugins['all'][ $plugin_file ], $api_data ); - - } elseif ( isset( $current->no_update[ $plugin_file ] ) ) { - // Plugin is up-to-date, but we still want API data (tested, requires, etc.) - $api_data = (array) $current->no_update[ $plugin_file ]; - $plugins['all'][ $plugin_file ] = array_merge( $plugins['all'][ $plugin_file ], $api_data ); } } } @@ -472,8 +454,7 @@ public function search_box( $text, $input_id ) { ?> false, 'donate_link' => false, 'preview_link' => false, - ) + ), ) ); @@ -1585,7 +1566,7 @@ public function single_row( $item ) { /* translators: 1: Current WordPress version, 2: Version the plugin was tested up to. */ __( 'This plugin has not been tested with your current version of WordPress (%1$s). It may still work, but consider checking for an update or contacting the plugin author. Last tested with WordPress %2$s.' ), $wp_version, - $tested_wp, + $tested_wp ); /** From c8a3bb0c31f9c06db267941293d269e869c4253a Mon Sep 17 00:00:00 2001 From: AKSHAT2802 Date: Tue, 2 Dec 2025 15:12:57 +0530 Subject: [PATCH 03/11] fix: Align parameter documentation for tested WordPress version in WP_Plugins_List_Table --- src/wp-admin/includes/class-wp-plugins-list-table.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 35d1864d1f377..910c1155a0ab1 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -1579,7 +1579,7 @@ public function single_row( $item ) { * @param array $plugin_data An array of plugin data. See get_plugin_data() * and the {@see 'plugin_row_meta'} filter for the list * of possible values. - * @param string $tested_wp The WordPress version the plugin was tested up to. + * @param string $tested_wp The WordPress version the plugin was tested up to. * @param string $wp_version Current WordPress version. */ $show_compat_warning = apply_filters( @@ -1601,7 +1601,7 @@ public function single_row( $item ) { * @param array $plugin_data An array of plugin data. See get_plugin_data() * and the {@see 'plugin_row_meta'} filter for the list * of possible values. - * @param string $tested_wp The WordPress version the plugin was tested up to. + * @param string $tested_wp The WordPress version the plugin was tested up to. * @param string $wp_version Current WordPress version. */ $compat_message = apply_filters( From daec280a683dfded925c49c6e7482b45d9e0a7c8 Mon Sep 17 00:00:00 2001 From: Akshat Kakkad <87222220+AKSHAT2802@users.noreply.github.com> Date: Thu, 4 Dec 2025 10:41:34 +0530 Subject: [PATCH 04/11] Update src/wp-includes/functions.php Co-authored-by: Weston Ruter --- src/wp-includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 96bb5d9f8c50c..3f0fd8cafbb33 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -8977,7 +8977,7 @@ function is_wp_version_compatible( $required ) { /** * Checks compatibility with the tested WordPress version. * - * @since 6.9.0 + * @since 7.0.0 * * @global string $_wp_tests_wp_version The WordPress version string. Used only in Core tests. * From 3e75e4490c8412a75c2efc36c12440f4c33da656 Mon Sep 17 00:00:00 2001 From: Akshat Kakkad <87222220+AKSHAT2802@users.noreply.github.com> Date: Thu, 4 Dec 2025 10:41:42 +0530 Subject: [PATCH 05/11] Update src/wp-admin/includes/class-wp-plugins-list-table.php Co-authored-by: Weston Ruter --- src/wp-admin/includes/class-wp-plugins-list-table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 910c1155a0ab1..3187b78dd1ef8 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -1594,7 +1594,7 @@ public function single_row( $item ) { /** * Filters the compatibility warning message for a plugin. * - * @since 6.8.0 + * @since 7.0.0 * * @param string $compat_message The compatibility warning message. * @param string $plugin_file Path to the plugin file relative to the plugins directory. From d50c162cb362c24b289579d6741c0aba2564d3c7 Mon Sep 17 00:00:00 2001 From: Akshat Kakkad <87222220+AKSHAT2802@users.noreply.github.com> Date: Thu, 4 Dec 2025 10:41:51 +0530 Subject: [PATCH 06/11] Update src/wp-admin/includes/class-wp-plugins-list-table.php Co-authored-by: Weston Ruter --- src/wp-admin/includes/class-wp-plugins-list-table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 3187b78dd1ef8..6b4242b8dbb4f 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -1572,7 +1572,7 @@ public function single_row( $item ) { /** * Filters whether to show compatibility warning for a plugin. * - * @since 6.8.0 + * @since 7.0.0 * * @param bool $show_compat_warning Whether to show the compatibility warning. * @param string $plugin_file Path to the plugin file relative to the plugins directory. From 43ff073404a5f66d9ff7807f5c869811e724abcf Mon Sep 17 00:00:00 2001 From: Akshat Kakkad <87222220+AKSHAT2802@users.noreply.github.com> Date: Thu, 4 Dec 2025 10:42:52 +0530 Subject: [PATCH 07/11] Simplify conditionals Co-authored-by: Weston Ruter --- src/wp-admin/includes/class-wp-plugins-list-table.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 6b4242b8dbb4f..244d593128bb6 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -800,11 +800,7 @@ public function single_row( $item ) { $tested_compatible = true; if ( ! is_wp_error( $plugin_information ) && isset( $plugin_information->tested ) ) { - $tested_wp = $plugin_information->tested; - } - - if ( null !== $tested_wp ) { - $tested_compatible = is_tested_wp_version_compatible( $tested_wp ); + $tested_compatible = is_tested_wp_version_compatible( $plugin_information->tested ); } $has_dependents = WP_Plugin_Dependencies::has_dependents( $plugin_file ); From 64b0135882e4ed52ea06bb15801841d53ebd0e39 Mon Sep 17 00:00:00 2001 From: Akshat Kakkad <87222220+AKSHAT2802@users.noreply.github.com> Date: Thu, 4 Dec 2025 10:43:36 +0530 Subject: [PATCH 08/11] Use array_fill_keys Co-authored-by: Weston Ruter --- .../includes/class-wp-plugins-list-table.php | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 244d593128bb6..8d5a7c9c62b67 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -767,31 +767,34 @@ public function single_row( $item ) { 'plugin_information', array( 'slug' => $plugin_slug, - 'fields' => array( - 'sections' => false, - 'rating' => false, - 'downloaded' => false, - 'last_updated' => false, - 'banners' => false, - 'icons' => false, - 'active_installs' => false, - 'short_description' => false, - 'tags' => false, - 'compatibility' => false, - 'contributors' => false, - 'ratings' => false, - 'screenshots' => false, - 'support_url' => false, - 'added' => false, - 'homepage' => false, - 'download_link' => false, - 'upgrade_notice' => false, - 'versions' => false, - 'business_model' => false, - 'repository_url' => false, - 'commercial_support_url' => false, - 'donate_link' => false, - 'preview_link' => false, + 'fields' => array_fill_keys( + array( + 'sections', + 'rating', + 'downloaded', + 'last_updated', + 'banners', + 'icons', + 'active_installs', + 'short_description', + 'tags', + 'compatibility', + 'contributors', + 'ratings', + 'screenshots', + 'support_url', + 'added', + 'homepage', + 'download_link', + 'upgrade_notice', + 'versions', + 'business_model', + 'repository_url', + 'commercial_support_url', + 'donate_link', + 'preview_link', + ), + false ), ) ); From b75102fcb48d20b373f687342f0919ed78a55dc4 Mon Sep 17 00:00:00 2001 From: Akshat Kakkad <87222220+AKSHAT2802@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:49:37 +0530 Subject: [PATCH 09/11] Update src/wp-admin/includes/class-wp-plugins-list-table.php Co-authored-by: Weston Ruter --- .../includes/class-wp-plugins-list-table.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 221c38c7fbb73..97fe6af77d1a3 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -1643,9 +1643,15 @@ public function single_row( $item ) { $details_link = ''; if ( current_user_can( 'install_plugins' ) ) { - $details_url = network_admin_url( - 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . - '&TB_iframe=true&width=600&height=550' + $details_url = add_query_arg( + network_admin_url( 'plugin-install.php' ), + array( + 'tab' => 'plugin-information', + 'plugin' => urlencode( $plugin_data['slug'] ), + 'TB_iframe' => 'true', + 'width' => 600, + 'height' => 550, + ) ); $details_link = sprintf( From 5803b3c34eccbd98f128cf261b7a4fa3ed29e80d Mon Sep 17 00:00:00 2001 From: Akshat Kakkad <87222220+AKSHAT2802@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:50:12 +0530 Subject: [PATCH 10/11] Update src/wp-admin/includes/class-wp-plugins-list-table.php Co-authored-by: Weston Ruter --- src/wp-admin/includes/class-wp-plugins-list-table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index 97fe6af77d1a3..b345754251711 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -1632,7 +1632,7 @@ public function single_row( $item ) { if ( $show_compat_warning && ! empty( $compat_message ) ) { printf( '', - $is_active ? ' active' : ' inactive', + esc_attr( $is_active ? 'active' : 'inactive' ), esc_attr( $plugin_slug . '-compat-warning' ), esc_attr( $plugin_slug ), esc_attr( $plugin_file ), From 2427e89881ba87c1dcea0d7d230b78881178b697 Mon Sep 17 00:00:00 2001 From: Akshat Kakkad <87222220+AKSHAT2802@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:50:26 +0530 Subject: [PATCH 11/11] Update src/wp-admin/includes/class-wp-plugins-list-table.php Co-authored-by: Weston Ruter --- src/wp-admin/includes/class-wp-plugins-list-table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index b345754251711..69afe02ab9891 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -1631,7 +1631,7 @@ public function single_row( $item ) { if ( $show_compat_warning && ! empty( $compat_message ) ) { printf( - '', + '', esc_attr( $is_active ? 'active' : 'inactive' ), esc_attr( $plugin_slug . '-compat-warning' ), esc_attr( $plugin_slug ),