Make WordPress Core

Opened 5 months ago

Last modified 3 months ago

#64445 new enhancement

Expose disk size for each installed plugin

Reported by: maulikmakwana2008's profile maulikmakwana2008 Owned by:
Milestone: 7.1 Priority: normal
Severity: normal Version:
Component: Site Health Keywords: has-patch has-screenshots changes-requested
Focuses: ui Cc:

Description

Currently, WordPress displays metadata such as Version, Author, and Details below each plugin name on the Plugins screen. However, there is no built-in way to view how much disk space an installed plugin consumes.

This enhancement proposes displaying the Plugin Size inline with existing metadata, improving transparency for administrators managing storage, backups, and performance—especially on shared or limited hosting environments.

Current Output
Version 5.6 | By Automattic – Anti-spam Team | View details

Proposed Output
Version 5.6 | Plugin Size 1.42 MB | By Automattic – Anti-spam Team | View details

Why This Belongs in Core

  • No UI clutter (uses existing plugin meta row)
  • Helps identify large plugins quickly
  • No frontend impact
  • No database schema changes
  • Uses existing WordPress hooks
  • Avoids need for third-party plugins

Technical Approach

  • Hook into plugin_row_meta to append plugin size
  • Calculate size from the plugin’s directory
  • Cache size using transients to prevent repeated filesystem scans
  • Clear cache on plugin update or deletion
  • Admin-only execution

Attachments (3)

show-plugin-directory-size.patch (3.3 KB) - added by maulikmakwana2008 5 months ago.
directories-and-sizes-tree-structure.patch (6.0 KB) - added by maulikmakwana2008 5 months ago.
Updated64445.jpg (134.5 KB) - added by maulikmakwana2008 4 months ago.

Download all attachments as: .zip

Change History (20)

#1 @westonruter
5 months ago

  • Component changed from Administration to Site Health
  • Keywords needs-patch added; has-patch needs-testing removed
  • Version trunk deleted

I don't think this is appropriate for plugins list table. I would imagine plugin size is rarely if ever an issue when compared with the amount of storage taken up by uploaded images.

So if we do this, I think it would make more sense to add to Site Health info, to break down the current "Plugins directory size" entry into the sizes for individual plugins.

#2 @westonruter
5 months ago

  • Focuses performance removed
  • Keywords 2nd-opinion added
  • Summary changed from Add the plugin directory size to the plugin meta row on the Plugins screen (wp-admin/plugins.php) next to the Version information. to Expose disk size for each installed plugin

#3 @maulikmakwana2008
5 months ago

  • Keywords needs-testing has-patch added; needs-patch removed
  • Version set to trunk

@westonruter
Patch attached.

This patch extends Site Health → Info → Directories and Sizes to expose
disk usage for each individual installed plugin.

It reuses existing filesystem logic via WP_Filesystem_Direct::dirsize(),
consistent with how core already calculates directory sizes, and adds
a new “Plugins (individual)” entry to the Site Health debug data.

The calculation runs only when viewing Site Health Info and does not
impact normal admin or front-end requests. No UI changes are introduced,
and no new public APIs are added.

Feedback welcome.

#4 @westonruter
5 months ago

  • Keywords needs-refresh added; 2nd-opinion removed
  • Milestone changed from Awaiting Review to 7.0
  • Version trunk deleted

The "version" field indicates when the issue was first introduced. It's not something newly in trunk, so this can be left blank.

Please open a pull request with the patch to facilitate review and testing. This is more helpful than attaching a patch file.

This ticket was mentioned in PR #10671 on WordPress/wordpress-develop by @maulikmakwana2008.


4 months ago
#5

  • Keywords needs-refresh removed

#6 @maulikmakwana2008
4 months ago

  • Keywords has-pr added
  • Version set to trunk

@westonruter
you can review added PR request https://github.com/WordPress/wordpress-develop/pull/10671 and attached Updated64445.jpg

#7 @westonruter
4 months ago

  • Version trunk deleted

Please leave the version blank, or else it could be set to back when the site info was added.

#8 @maulikmakwana2008
4 months ago

@westonruter
Thanks for the clarification. I don’t have permission to update the Version field, but I agree it should be left blank.

#9 @westonruter
4 months ago

@maulikmakwana2008 you set it to trunk again in your previous update.

#10 @r1k0
4 months ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/10671

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: Firefox 146.0
  • OS: Ubuntu
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Actual Results

  1. ✅ Issue resolved with patch.

Before:

https://i.ibb.co/8L2GGh4x/before-plugin-sizes.png

After:

https://i.ibb.co/S48605Kb/after-plugin-sizes.png

#11 @ozgursar
4 months ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/10671

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:
    • Performance Lab 4.0.1
    • Test Reports 1.2.1

Actual Results

  1. ✅ Issue resolved with patch.

Screenshots

Before After
https://i.snipboard.io/R5ozCN.jpg https://i.snipboard.io/XdPIAe.jpg

Additional Notes

  • Plugins can create files/folders outside their base folder. For example, they usually store certain files in the /wp-content/uploads/[plugin-name] folder. Therefore, this patch doesn't calculate disk space usage for files created outside the plugin's base directory.
Last edited 4 months ago by ozgursar (previous) (diff)

#12 @SirLouen
4 months ago

  • Keywords has-screenshots added; needs-testing has-pr removed

#13 @westonruter
4 months ago

  • Keywords changes-requested added

This ticket was mentioned in Slack in #core by maulik_makwana. View the logs.


3 months ago

@vishalkakadiya commented on PR #10878:


3 months ago
#16

Raised a PR which adds Theme Sizes, Plugin Sizes and Upload Directory Content (except media) path sizes:

https://github.com/user-attachments/assets/5d5e0f6d-981e-4f24-ba1d-060cdccc220a

#17 @audrasjb
3 months ago

  • Milestone changed from 7.0 to 7.1

WP 7.0 pre-beta1 Triage:
The last PR still needs review and tests. Moving to 7.1.

Note: See TracTickets for help on using tickets.