Make WordPress Core

Opened 5 weeks ago

Last modified 3 days ago

#64424 new enhancement

Add “Download” action for locally installed plugins in Plugins admin screen

Reported by: iflairwebtechnologies's profile iflairwebtechnologies Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Plugins Keywords: has-patch needs-unit-tests 2nd-opinion
Focuses: administration Cc:

Description

Problem:
WordPress currently allows downloading plugins only from wordpress.org.
There is no way to download a ZIP of locally installed plugins (custom, premium,
or modified plugins) directly from the Plugins admin screen.

This is inconvenient for site owners and developers who need to:

  • Back up plugins
  • Transfer plugins between environments
  • Share custom plugins
  • Download modified versions


Proposed solution:
Add a "Download" row action to the Plugins admin list table that allows users
with update_plugins capability to download a ZIP archive of the locally
installed plugin.

Behavior:

  • Works for both folder-based and single-file plugins
  • Generates ZIP from the local plugin directory/file
  • Uses nonces and capability checks
  • Available only to users with update_plugins capability
  • Does not affect plugin update or delete logic


Implementation:

  • Adds a row action in WP_Plugins_List_Table::single_row()
  • Handles download via a secure admin action in wp-admin/plugins.php
  • Uses existing core ZIP utilities (PclZip)
  • No UI changes outside the Plugins list table


Why core:
This functionality cannot be reliably implemented in a plugin or theme,
as it requires:

  • Access to internal plugin list table rendering
  • Secure handling before admin output
  • Consistent behavior across all plugin types


I am happy to provide a patch and iterate based on feedback.

Attachments (3)

plugin-download.patch (3.1 KB) - added by iflairwebtechnologies 5 weeks ago.
64424-plugin-editor-download.patch (2.2 KB) - added by iflairwebtechnologies 2 weeks ago.
64424-plugin-editor-download
64424-plugin-editor-download-title-issue-fix.patch (2.7 KB) - added by iflairwebtechnologies 3 days ago.
64424-plugin-editor-download-title-issue-fixed

Download all attachments as: .zip

Change History (12)

#1 @iflairwebtechnologies
5 weeks ago

  • Keywords has-patch added; needs-patch removed

This patch adds a “Download” row action to the Plugins admin screen,
allowing users with the update_plugins capability to download a ZIP
of the locally installed plugin.

The implementation:

  • Works for both directory-based and single-file plugins
  • Generates the ZIP from the local plugin source
  • Uses nonces and capability checks
  • Uses existing core ZIP utilities (PclZip)
  • Does not alter existing plugin activation, update, or deletion logic


Feedback and suggestions are welcome.

#2 @mindctrl
5 weeks ago

  • Keywords needs-unit-tests 2nd-opinion added

#3 follow-up: @sabernhardt
3 weeks ago

  • Focuses administration added
  • Version trunk deleted

I do not agree with adding a row action for every plugin in the Plugins list table.

  1. I think that most administrators would never use any of the extra links (and consider them to be clutter).
  2. Even the people who would want the download links probably would not use them often.
  3. Authors of premium plugins might not appreciate giving easier access to packaged copies of their files.

However, a download link could fit somewhere on the Plugin File Editor screen, which already checks for the 'edit_plugins' capability. People who edit the plugins are more likely to want to download a revised plugin.

Related: #64439 (themes)

#4 @iflairwebtechnologies
2 weeks ago

Thanks for the feedback, I understand the concern around adding additional row actions to the Plugins list table and the risk of UI clutter for most users.

I agree that the Plugins screen should remain focused on common workflows, and that a “Download” action may not be appropriate there for all users.

Placing this functionality on the Plugin File Editor screen makes sense, as it is already an advanced/admin-only area and better aligns with use cases such as backing up, migrating, or downloading modified plugins.

Based on this suggestion, I’m happy to revise the approach and update the patch to add a “Download ZIP” action within the Plugin File Editor instead, with proper capability checks and nonces.

I’ll follow up with an updated patch for review. Feedback on this revised direction is welcome.

@iflairwebtechnologies
2 weeks ago

64424-plugin-editor-download

#5 @iflairwebtechnologies
2 weeks ago

This patch updates the original approach and adds a “Download ZIP” action to the Plugin File Editor screen instead of the Plugins list table. It supersedes the previous patch.

#6 @huzaifaalmesbah
9 days ago

Test Report & Feedback

Patch tested: https://core.trac.wordpress.org/attachment/ticket/64424/64424-plugin-editor-download.patch

Feature Description

This patch adds a “Download Plugin” button to the Plugin File Editor, allowing users to download the active plugin directly from the editor screen.

Steps to Reproduce or Test

  1. Navigate to Tools in the WordPress admin dashboard.
  2. Open Plugin File Editor.
  3. Observe that the Download Plugin button is not displayed before applying the patch.

Expected Results

  • ✅ A Download Plugin button should be visible in the Plugin File Editor.
  • ✅ Users should be able to download the selected plugin as a ZIP file.

Environment

  • WordPress: 7.0-alpha-61215-src
  • PHP: 8.2.29
  • Server: nginx/1.29.4
  • Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 143.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Actual Results

Before applying the patch

  • ❌ The Download Plugin button was not available in the Plugin File Editor.

After applying the patch

  • ✅ The Download Plugin button is now displayed correctly.
  • ✅ The feature works as expected and allows downloading the plugin.

Additional Issue: Plugin Download Filename Format

When clicking the Download Plugin button, the downloaded ZIP file name appears as:

  • ❌ Test-Reports.zip

This uses a title-style / CamelCase format.

Expected / Suggested Behavior

  • ✅ Use the plugin slug format for the downloaded file name, for example:
    • test-reports.zip
    • test-reports.1.2.1.zip

Including the plugin version in the filename (e.g. test-reports.1.2.1.zip) would better align with common WordPress plugin distribution practices, make version tracking easier for users, and reduce confusion when storing multiple plugin backups.

UI / UX Suggestion

Currently, the Download Plugin button appears in a separate row from the Update File button.

From a UI/UX perspective, it may be cleaner and more intuitive to place both Update File and Download Plugin actions on the same row, as they are closely related actions. Grouping them together could improve visual consistency, reduce vertical spacing, and make related actions easier to discover.

Screenshots

https://i.ibb.co.com/rRr5DHk0/Huzaifa-20260114104435.png

Last edited 9 days ago by huzaifaalmesbah (previous) (diff)

#7 in reply to: ↑ 3 @azaozz
8 days ago

Replying to sabernhardt:

However, a download link could fit somewhere on the Plugin File Editor screen, which already checks for the 'edit_plugins' capability.

Yep, also thinking that the Plugin File Editor (and Theme File Editor) screens are the right place to add this.

People who edit the plugins are more likely to want to download a revised plugin.

Imho an even more important/useful reason would be to make a backup of the original files before editing. This can actually be incorporated in a warning. Something like:

Please ensure that you have a recent backup of the plugin (theme) before editing. The back-up plugin (theme) can be restored by uploading it in a .zip format from the Add Plugins screen.
[Download zip]

Then this becomes a pretty nice functionality enhancement for the Plugin File Editor (and Theme File Editor) screens.

#8 @azaozz
8 days ago

Also thinking this should be implemented by using the Filesystem API, see https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-wp-filesystem-base.php and similar.

Last edited 8 days ago by azaozz (previous) (diff)

@iflairwebtechnologies
3 days ago

64424-plugin-editor-download-title-issue-fixed

#9 @iflairwebtechnologies
3 days ago

I’ve uploaded a new patch that fixes the plugin download filename issue.
The downloaded ZIP now uses the plugin slug format with the current plugin version (kebab-case) instead of CamelCase, aligning with WordPress best practices.

Please review and let me know if any additional changes are needed.

Note: See TracTickets for help on using tickets.