Every WordPress site over about two years old has the same room in it: a media library nobody has opened on purpose since the theme was installed. Thousands of files, a third of them unused, most of them larger than they need to be, all of them named things like IMG_4471 and screenshot-2.
It is not a crisis. It is more like a garage. But it quietly costs you backup time, storage, page weight and, on the day you finally want to reuse an old photograph, about twenty minutes of scrolling.
What is actually in there
Before deleting anything, it helps to know what the library is made of, because most of it is not what people assume.
When you upload one photograph, WordPress does not store one file. It stores the original plus a set of resized copies: thumbnail, medium, large, and whatever additional sizes your theme and plugins have registered. A site with a page builder and a shop plugin can easily have eight or nine registered sizes, which means one upload becomes ten files on disk.
This is mostly good. Those copies are what let the browser download a small picture on a phone instead of a large one. But it means two things: the size of your uploads folder is not the size of your images, and deleting things has consequences you should understand before you start.
The four piles
Sorting a library is easier when you stop thinking of it as one problem. There are four separate ones.
1. Originals that are far too big
A modern phone produces images around 4000 pixels wide. A website almost never displays anything above 2000. Every one of those originals is sitting in your uploads folder at full resolution, and every backup copies them again.
This is the biggest single win and the least risky. Re-encoding the originals down to a sensible maximum, say 2560 pixels on the long edge, typically cuts the folder by half or more, and nothing on the site looks different, because the site was never showing the original anyway.
2. Files nothing links to
Images uploaded for a post that was rewritten, a header that was replaced, a product that was deleted. They are invisible and harmless, but they are also the reason your library has four thousand entries instead of nine hundred.
Be careful here. “Unused” is genuinely hard to determine, because an image can be referenced from a page builder’s serialised data, a widget, a custom field, a CSS file or a theme option, and a naive check will miss all of those and cheerfully tell you a live logo is unused. Use a tool that scans post content, meta and options, review the list rather than trusting it, and take a backup first. Every time.
3. Duplicates
The same picture uploaded three times because three people needed it, usually under three different names. Duplicates are worth finding not mainly for the storage but because they fragment your library: you can never remember which copy is the good one.
4. Files with no information attached
No title worth reading, no alt text, no caption. This is the pile that costs you the most and looks like it costs nothing, because it is the reason nobody can find anything. More on that below.
Do the safe things first
There is a natural order, from lowest risk to highest.
- Back up. Files and database. Not negotiable, because the next four steps all delete or overwrite something.
- Regenerate and shrink the originals. Nothing is deleted, the site is unchanged, the folder gets dramatically smaller.
- Convert to a modern format where your setup supports it, keeping the originals until you have looked at a sample.
- Add the missing metadata, which is additive and cannot break anything.
- Then, and only then, delete. Start with obvious duplicates, then the unused list, in batches, checking the site between batches.
Naming, so that this never happens again
The reason the library is unsearchable is that filenames carry no meaning. IMG_4471 tells you nothing, and neither does screenshot-2, and once there are two thousand of them the only search that works is scrolling.
A filename convention costs nothing and pays forever. Something like subject-context-variant.jpg: walnut-desk-side-angle.jpg, team-portrait-anna-2026.jpg. Lowercase, hyphens rather than spaces or underscores, no dates unless the date is genuinely part of the identity.
As a bonus, the filename is a small ranking signal for image search, and it is what appears if the image ever fails to load. But the real reason is the one that shows up two years later, when you type “walnut” into the search box and find the picture in four seconds.
Folders and tags are not the same thing
WordPress has no native folders for media, which is why so many plugins add them. Folders are good for the question “where does this belong”, and they have one hard limitation: a file lives in exactly one of them.
Tags answer a different question: “what is this about”. A photograph can be tagged product, autumn and outdoor at once, and turn up in all three searches. Most libraries want both: a small number of folders reflecting how work arrives, and a generous number of tags reflecting how work is looked for.
Keep the folder count low. A hierarchy nobody can hold in their head gets abandoned within a month, and then you have two systems, which is worse than none.
The part that actually pays off
If you only do one thing, do the descriptions. A library where every image has a real title, alt text and a few tags stops being a pile and becomes a searchable archive. That changes behavior: people reuse the picture that exists instead of uploading a new copy, which is what caused half the mess in the first place.
Doing it by hand for an existing library is unrealistic, which is exactly why it never gets done. Generating a first pass automatically and then correcting the ones that matter is realistic, and an hour of correcting beats a week of typing.
Then keep it that way
A clean library drifts back within a year unless something holds the line. Three habits do most of the work: resize before uploading rather than after, name the file before it leaves your computer, and write the alt text at the moment you insert the image, when you still remember what it is.
None of that is interesting. All of it is cheaper than doing this again.