Normal view

Anyone else's media library just... die after 10k+ files? Here's what finally fixed it for us

21 August 2026 at 08:19

Hi folks,

Been managing a bunch of client sites and hit that wall where the Media Library just stops being usable once you're past a few thousand images/videos. "Just install a caching plugin bro" doesn't really cut it at that scale. Wrote up everything that actually worked for us here, but here's the gist:

The database is probably your real bottleneck

Turns out wp_posts isn't indexed well for big media libraries by default, so admin queries crawl. Adding an index on post_type, post_status, post_date (plus one on wp_postmeta for meta lookups) made a noticeable difference for us. Also worth trimming how many image sizes your theme registers — we had way more than we needed and it was just bloating wp_postmeta for no reason.

If you're not already running Redis or Memcached for object caching, that's basically mandatory at this scale. Longer TTLs on attachment queries especially.

The admin UI itself is dumb about large libraries

You can drop the items-per-page in Media Library with a filter — we went down to 40 and it noticeably sped up load times once we crossed 10k files. There are also some plugins that do virtual scrolling so it's not trying to render your entire library at once, which helps a lot.

Offloading to S3/R2 was honestly the biggest win

If you're still storing everything locally, this is probably the single best long-term fix. We went with Cloudflare R2 mainly because of no egress fees — WP Offload Media handles the syncing and URL rewriting for you, and you can set it to nuke the local copies after upload so you're not double-storing everything.

Also — check your inodes if you're on a VPS

This one bit us before we knew to look for it. Every file = 1 inode, and once you're at 50k+ files you can run out of inodes before you even hit your storage cap. df -i will show you where you stand. If you're close, start cleaning up old revisions, unused thumbnail sizes, spam attachments, that kind of thing.

For actually organizing the chaos

Media Library Assistant is great if you need bulk editing or EXIF/IPTC stuff for photography sites. FileBird or Real Media Library are nice if scrolling through one giant flat list is making you want to throw your laptop.

Anyway, full writeup with the actual code snippets is here if you want to go deeper on any of this. Curious if anyone's dealing with even bigger libraries (20k+) — what are you doing that's more extreme than this?

submitted by /u/anouarabsslm
[link] [comments]
❌