Description
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
Screenshots


Installation
- Upload the
s404-orphaned-attachment-scannerfolder to/wp-content/plugins/ - Activate through Plugins Installed Plugins
- Navigate to Tools S404OrphanedAttachmentScanner
FAQ
-
Will this delete anything automatically?
-
No. The plugin never deletes anything automatically. All destructive actions require explicit user confirmation.
-
What is the “Filesystem” detector?
-
It searches your active theme’s PHP/HTML/JS/CSS files for any hard-coded references to an image’s filename or URL. You can also enable full-installation scanning (all files under ABSPATH) in Settings.
-
Can I protect specific images from being flagged?
-
Yes — add their attachment IDs to the Exclusions list in Settings, or click the “Exclude” button on any result row.
-
Does it work with WooCommerce / ACF / Elementor?
-
Yes. The relevant detectors activate automatically when those plugins are present.
-
By default, WordPress disables the recycle bin for media files. To enable it and make the “Move to Trash” button functional, add this line to your
wp-config.phpfile:
define( ‘MEDIA_TRASH’, true ); -
What PHP version is required?
-
PHP 7.4 or higher.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“s404 Orphaned Attachment Scanner” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “s404 Orphaned Attachment Scanner” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0.0
- Initial release
