s404 Orphaned Attachment Scanner
·
Scan your WordPress Media Library for orphaned attachments and safely delete them to reclaim disk space.
s404 Orphaned Attachment Scanner helps you find and remove media files that are sitting in your WordPress Media Library but are not used anywhere in your installation — not in posts, pages, widgets, theme customizer, ACF fields, WooCommerce products, page-builder data, or any active plugin's settings.
Features
- Batched AJAX scan — never times out on large libraries
- 9 detection layers — post content, post meta, featured images, widgets, theme customizer, ACF, WooCommerce, page builders (Elementor, Beaver Builder, Divi, Bricks…), ALL active plugin wp_options
- Filesystem scan — checks theme files and optionally the entire WP installation for hard-coded references
- Format filtering — scan only images, video, audio, documents, or specific formats (JPEG, PNG, WebP, SVG…)
- Age threshold — only flag files older than N days, protecting freshly uploaded assets
- Trash & Permanent Delete — move items to Trash for safety (requires
define('MEDIA_TRASH', true);in yourwp-config.phpto enable the media bin) - Deletion log — every action is recorded with timestamp and username in your local history
- Bulk actions — select, trash, delete, exclude, or export to CSV
- Exclusion list — permanently hide specific IDs, MIME types, or path patterns from scan results
- Scheduled scans — WP-Cron with daily/weekly/monthly frequency and optional email report
- Developer hooks —
s404as_is_attachment_usedfilter,s404as_before_delete/s404as_after_deleteactions
Usage
- Go to Tools → S404OrphanedAttachmentScanner
- Optionally select format filters
- Click Start Scan
- Review results — preview thumbnails, file sizes, MIME types
- Select items and use bulk actions, or use per-row buttons
- Export a CSV for your records before deleting
