Clean up WordPress media without breaking pages
An image labelled unattached in WordPress may still be used on the website. That label is not proof the file is safe to delete. Media deletion can break page images, downloadable menus and links shared outside the site. Start with an inventory and recoverable copies, not a bulk-delete filter.
Useful context
- Confirm that you have a usable backup of the media and relevant website data.
- Choose a small, clearly identified group of files to review.
- Keep the original files outside the website’s Media Library.
How it works
Identify candidates precisely
Compare filenames, thumbnails, dimensions and upload dates. Two similar images may have different crops or purposes. Record the file URL before any change so it can be searched for and checked; a thumbnail alone can make different versions look identical.
Find where the file is used
Check relevant pages, posts, featured images, galleries and theme settings. Consider custom blocks, styles and documents linked from emails or printed QR codes. The platform’s attachment label may not describe all these references, so unresolved usage is a reason to keep the file.
Replace references before removing anything
If a genuine duplicate should be retired, update each known reference to the retained file and check the page. For a PDF menu, make sure the replacement is the approved current version. Avoid changing ten files at once if you cannot identify which one caused a problem.
Delete only a confirmed unnecessary copy
Use the normal Media Library controls only after the owner has approved the exact file and recovery copy. Read the permanent-deletion warning. Check the affected pages again and retain the change record in case somebody later reports a missing external download.
What to check
- Retained images and downloads still load at their intended locations.
- Original files remain recoverable outside the library.
- No file was removed solely because its attachment field was empty.
Sources and further reading
Platform features can change. Check the provider’s current guidance before changing a live service.
