Make WordPress Core

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:

  1. Closed / Removed / Suspended: (closed => true, status => 'closed'|'disabled'|'suspend', closed_date, reason, reason_text, is_security => true|false).
  2. Outdated / Abandoned: (is_outdated => true, outdated_notice => string, tested beyond the last three major WordPress versions or not modified for more than two years).
  3. Inaccessible for Security Reasons: (is_security => true or reason => '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


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, and outdated_notice in both the response and no_update arrays of the update_plugins transient.
  • Populate standalone closed response items into no_update.
  • In wp_update_themes():
  • Preserve closed, status, is_closed, is_suspended, is_security, is_outdated, outdated_notice, closed_date, and reason metadata in both the response and no_update arrays of the update_themes transient.

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 in no_update when they are flagged as closed or outdated.
  • In wp_plugin_update_row():
  • Security closures (is_security === true or reason === 'security-issue'): Displays .notice.notice-error.inline.notice-alt with role="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, and Outdated) are rendered alongside the plugin title, with .screen-reader-text accessibility 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() exports closed, is_suspended, is_security, is_outdated, closedDate, closedReason, and outdatedNotice to JavaScript.
  • Theme card overlays and badges are rendered on both PHP non-JS cards and Underscore templates (tmpl-theme and tmpl-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_themes test under direct tests in WP_Site_Health::get_tests().
  • Critical status:
  • Triggered when an active plugin or active theme was closed due to a security issue (is_security === true or reason === '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() and themes_api():
  • Gracefully allow objects with error => 'closed' to pass through without converting them into a generic WP_Error.
  • In install_plugin_information() and install_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 => true
  • is_security => true
  • closed_date => '2025-01-15'
  • closed_reason => 'security-issue'
  • A plugin having:
  • closed => true
  • reason_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.

Attachments (1)

66239.patch​ (74.3 KB ) - added by mralidoosti 6 weeks ago.

Download all attachments as: .zip

Change History (4)

This ticket was mentioned in ​PR #13974 on ​WordPress/wordpress-develop by ​@mralidoosti.


6 weeks ago
#1

Written by @mralidoosti on WordPress.org.

Opened from the WordPress Contributor Toolkit.

#2 @afragen
6 weeks ago

This is probably better done as an API update/change. Returning the data then allows a plugin to take advantage of the results.

@obenland what do you think?

#3 @joedolson
5 weeks ago

  • Focuses accessibility removed
Note: See TracTickets for help on using tickets.