Add admin notice warning when installed plugins are not tested with the current WordPress version#10574
Add admin notice warning when installed plugins are not tested with the current WordPress version#10574AKSHAT2802 wants to merge 12 commits intoWordPress:trunkfrom
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
| /** | ||
| * Filters whether to show compatibility warning for a plugin. | ||
| * | ||
| * @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. | ||
| * @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 | ||
| ); |
There was a problem hiding this comment.
Why is this filter needed? Couldn't a plugin just filter plugin_compatibility_warning_message to be an empty string if they don't want to show the message?
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
| require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; | ||
| } | ||
|
|
||
| $plugin_information = plugins_api( |
There was a problem hiding this comment.
Won't this greatly slow down accessing the plugins screen, if every row rendering every row will involve a plugins_api() call?
| printf( | ||
| '<tr class="plugin-update-tr %s" id="%s" data-slug="%s" data-plugin="%s"><td colspan="%s" class="plugin-update colspanchange">', | ||
| esc_attr( $is_active ? 'active' : 'inactive' ), | ||
| esc_attr( $plugin_slug . '-compat-warning' ), | ||
| esc_attr( $plugin_slug ), | ||
| esc_attr( $plugin_file ), | ||
| esc_attr( $this->get_column_count() ) | ||
| ); |
There was a problem hiding this comment.
I'm not sure this is the best way to integrate this information. I think it would make sense to show where the after_plugin_row_meta action fires.
Trac ticket: https://core.trac.wordpress.org/ticket/40804
This PR introduces a new inline admin warning in the Plugins > Installed Plugins screen when a plugin’s "Tested up to" version (retrieved via plugins_api()) is lower than the current installed WordPress version.
The goal is to improve plugin maintenance visibility and help site owners quickly identify plugins that may no longer be actively tested or maintained without requiring them to open the plugin details modal.
This enhancement aligns with similar UX patterns used in the Plugin Directory, where outdated testing information already triggers caution labels.
Behavior
Example message:
This plugin has not been tested with your current version of WordPress (6.8). It may still work, but consider checking for an update or contacting the plugin author. Last tested with WordPress 6.6.New Filters Introduced
Allows controlling whether the warning should appear.
apply_filters( 'show_plugin_compatibility_warning', $show_compat_warning, $plugin_file, $plugin_data, $tested_wp, $wp_version );Allows customizing the text of the warning.
apply_filters( 'plugin_compatibility_warning_message', $compat_message, $plugin_file, $plugin_data, $tested_wp, $wp_version );Testing Instructions
Install any plugin with a "Tested up to" value lower than the current WordPress install.
Visit Plugins → Installed Plugins.
Confirm:
-- A warning row appears under the plugin.
--The text correctly inserts both version values.
-- The link opens the plugin details thickbox modal (if capabilities allow).