A couple of weeks ago, I was doing an audit in my employers Pegely server, and noticed that our CDN usage on one of the apps was fairly high. Digging in, I found that our uploads directory was very large. So I tried to find the largest files in the media upload admin page with no luck.
After some searching on WordPress’s plugins site, I didn’t find anything that fit the bill except for one that was close, but I didn’t like the underlying code.
The Plugin
So I went to work building the Media Sortable Filesize plugin, and after a few days had a working version published on GitHub: 1.0.0.

In version one, the plugin adds a simple column in the Media list view (doesn’t work in grid view – which is the new default) that displays the file size. It also adds the ability to sort by file size (but does require an index of the media library).
You can also use the Bulk actions dropdown to refresh selected attachments.
Steps to Index Media
- Make sure you are in the “list” view on the Media Library.
- Click the “Index Media” button.
- This will trigger a background CRON task to query all attachments, and extract the serialized meta array filesize to it’s own metakay (
_filesize
) so the library can be sorted bymeta_value_num
. - Note: If you have a large media library you may need to run this a few times. There is a 60 second timeout to avoid memory exhaustion. I’ve tested this with a 40,000 media library with no issues.
- This will trigger a background CRON task to query all attachments, and extract the serialized meta array filesize to it’s own metakay (
- There should no longer be any dashicons next to the file sizes.
One the plugin is activated, and new media uploads will automatically have their new meta filesize added.
Version 1.1.0 Update
Today I pushed 1.1.0 with two new features that will help in the future if a file is changed, and more info on intermediate file sizes.
A new meta box will display all intermediate image sizes as seen in the image above on the attachment page. You. can also (in list view) re-index a single image via CRON if a file is updated outside WordPress or via 3rd party.
Add your first comment to this post