Opened 6 weeks ago
Last modified 5 weeks ago
#66239 new feature request
Integrate WordPress.org closed, suspended, and outdated plugins and themes API data into Core
| Reported by: | mralidoosti | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Upgrade/Install | Version: | trunk |
| Severity: | normal | Keywords: | has-unit-tests has-patch needs-testing |
| Cc: | Focuses: | ui |
Description
WordPress.org Meta Trac ticket #8447(https://meta.trac.wordpress.org/ticket/8447) and WordPress.org PR #1004(https://github.com/WordPress/wordpress.org/pull/1004) updated the WordPress.org Plugin and Theme APIs to expose structured metadata when plugins or themes are:
- Closed / Removed / Suspended: (
closed => true,status => 'closed'|'disabled'|'suspend',closed_date,reason,reason_text,is_security => true|false). - Outdated / Abandoned: (
is_outdated => true,outdated_notice => string, tested beyond the last three major WordPress versions or not modified for more than two years). - Inaccessible for Security Reasons: (
is_security => trueorreason => 'security-issue').
Currently, WordPress Core lacks visibility into this metadata. Site administrators may be unaware when an installed plugin or theme has been removed from the repository due to a critical security issue, closed at the author's request, or abandoned without updates. Furthermore, opening the details modal for a closed item triggers a generic plugins_api_failed error ("An unexpected error occurred...") instead of explaining why the item is unavailable.
Related Links & Prior Art
- Meta Trac Ticket: https://meta.trac.wordpress.org/ticket/8447
- WordPress.org Pull Request: https://github.com/WordPress/wordpress.org/pull/1004
Proposed Solution & Changes
This patch adds complete Core support for storing, displaying, and alerting administrators about closed, suspended, outdated, or security-withdrawn plugins and themes.
1. Update Check & Transient Storage
wp-includes/update.php
- In
wp_update_plugins():
- Preserve
closed,closed_date,closed_reason,reason,reason_text,is_security,is_outdated, andoutdated_noticein both theresponseandno_updatearrays of theupdate_pluginstransient. - Populate standalone
closedresponse items intono_update.
- In
wp_update_themes():
- Preserve
closed,status,is_closed,is_suspended,is_security,is_outdated,outdated_notice,closed_date, andreasonmetadata in both theresponseandno_updatearrays of theupdate_themestransient.
2. Plugins List Table UI & Inline Notices
wp-admin/includes/update.php and wp-admin/includes/class-wp-plugins-list-table.php
wp_plugin_update_rows()now processes items inno_updatewhen they are flagged as closed or outdated.
- In
wp_plugin_update_row():
- Security closures (
is_security === trueorreason === 'security-issue'): Displays.notice.notice-error.inline.notice-altwithrole="alert": "Warning: This plugin was closed on [Date] due to a security issue and is no longer available for download. It should be uninstalled or replaced immediately."
- General closures:
Displays .notice.notice-warning.inline.notice-alt with role="status": "Notice: This plugin was closed on [Date] ([Reason]) and is no longer available for download."
- Outdated plugins:
Displays .notice.notice-warning.inline.notice-alt with role="status" and the value of outdated_notice.
- Status badges (
Closed (Security),Closed, andOutdated) are rendered alongside the plugin title, with.screen-reader-textaccessibility announcements.
3. Themes Screen UI & Preview Modal
wp-admin/includes/theme.php, wp-admin/themes.php, and src/js/_enqueues/wp/theme.js
wp_prepare_themes_for_js()exportsclosed,is_suspended,is_security,is_outdated,closedDate,closedReason, andoutdatedNoticeto JavaScript.- Theme card overlays and badges are rendered on both PHP non-JS cards and Underscore templates (
tmpl-themeandtmpl-theme-single). - Preview modals display prominent warning/error notices containing the closure date and reason.
4. Site Health Check Integration
wp-admin/includes/class-wp-site-health.php
- Adds the
closed_plugins_and_themestest under direct tests inWP_Site_Health::get_tests().
- Critical status:
- Triggered when an active plugin or active theme was closed due to a security issue (
is_security === trueorreason === 'security-issue'). - Includes direct deactivation/action links.
- Recommended status:
- Triggered when an active plugin or theme is closed for non-security reasons or marked as outdated.
5. API Client Handling
wp-admin/includes/plugin-install.php and wp-admin/includes/theme-install.php
- In
plugins_api()andthemes_api():
- Gracefully allow objects with
error => 'closed'to pass through without converting them into a genericWP_Error.
- In
install_plugin_information()andinstall_theme_information():
- Render a dedicated informational modal panel displaying the closure notice, date, reason, description, and slug instead of showing a fatal error screen.
Testing Instructions
1. Verify Unit Tests
Run the newly added PHPUnit test suites:
`bash
./vendor/bin/phpunit tests/phpunit/tests/plugins/closedPlugins.php
./vendor/bin/phpunit tests/phpunit/tests/theme/closedThemes.php
`
Both suites should pass with all assertions successful.
2. Simulate Closed & Outdated Plugins
Filter pre_http_request or set the update_plugins site transient with:
- A plugin having:
closed => trueis_security => trueclosed_date => '2025-01-15'closed_reason => 'security-issue'
- A plugin having:
closed => truereason_text => 'Author Request'closed_date => '2024-06-20'
- A plugin having:
is_outdated => true
Visit wp-admin/plugins.php and verify that the corresponding badges are displayed next to the plugin names:
- Red:
Closed (Security) - Grey:
Closed - Yellow:
Outdated
Also verify that the inline notice rows display the correct text, ARIA roles, and styling.
3. Check Site Health
Activate a plugin marked with is_security => true and navigate to:
wp-admin/site-health.php
Verify that Site Health reports a Critical status issue advising immediate deactivation and deletion, and that a direct deactivation link with a valid nonce is provided.
4. View Plugin & Theme Information Modals
Visit:
wp-admin/plugin-install.php?tab=plugin-information&plugin=[closed-slug]&TB_iframe=true
Confirm that a dedicated informational panel is displayed containing the closure date, reason, and description instead of the generic error message.
Written by @mralidoosti on WordPress.org.
Opened from the WordPress Contributor Toolkit.