WP Manifestindependent plugin directory
manifest / media / safe-media-cleaner

Safe Media Cleaner

Clean, optimize, and manage your WordPress media library by detecting unused, broken, and dynamically used media files.

by Atique Ullah · github.com/limpu/safe-media-cleaner · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/limpu/safe-media-cleaner/archive/refs/heads/main.zip

Safe Media Cleaner (WordPress Plugin)

Safe Media Cleaner helps you safely analyze, manage, and clean unused, broken, and unreferenced media files from your WordPress site. Over time, media files accumulate from deleted posts, page builders, sliders, theme changes, and failed imports—wasting storage, slowing backups, and increasing maintenance costs.

This plugin is built with a safety-first approach. No files are deleted automatically, and every cleanup action follows WordPress core standards with full user control and confirmation.

Plugin page & download: https://wordpress.org/plugins/safe-media-cleaner/


Media Scan

Media Scan analyzes your Media Library and database references to identify unused and orphaned attachments.

  • Detects media files not referenced in posts, pages, or supported plugins
  • Identifies orphaned attachments with missing or deleted parents
  • Supports Regular and Deep scan modes
  • Compatible with Classic Editor, Block Editor (Gutenberg), and popular page builders
  • Fast, batch-based scanning for large media libraries

Broken Media Scan

Broken Media Scan detects missing files and invalid media references that can cause broken layouts or front-end issues.

  • Finds broken image URLs and missing attachment files
  • Scans post content, custom fields, widgets, menus, and builder data
  • Supports Regular and Deep scan modes
  • Helps maintain visual integrity and reduce front-end errors

Live Site Scan

Live Site Scan analyzes your site’s front-end output to detect media that is actually used on public pages.

  • Scans rendered HTML output instead of only database references
  • Detects real-world media usage regardless of how content was built
  • Ideal for page builders, shortcodes, and dynamic layouts
  • Helps prevent accidental deletion of actively used media

Analytics & Logs

All scan activity and cleanup actions are logged for transparency and auditing.

  • Scan history and summaries
  • Media deletion and restore logs
  • Error and warning tracking
  • Useful for troubleshooting and accountability

Safe Deletion & Restore

Safe Media Cleaner follows WordPress best practices for all cleanup operations.

  • Media Library attachments are removed using wp_delete_attachment()
  • All generated image sizes and thumbnails are deleted together
  • Files are moved to trash before permanent deletion
  • Non-library files are restricted strictly to the uploads directory
  • Restore is available before permanent removal

Page Builder & Plugin Compatibility

Safe Media Cleaner detects media usage across popular builders and plugins, including:

  • Gutenberg Blocks
  • Elementor
  • Divi Builder
  • WPBakery Page Builder
  • Advanced Custom Fields (ACF)
  • Meta Box
  • Pods
  • WooCommerce product galleries and variations
  • Sliders (Revolution Slider, Smart Slider)
  • Widgets and navigation menus
  • Theme file references (Deep Scan only)

Security & Performance

  • All destructive actions are protected by capability checks and nonces
  • No external API calls, tracking, ads, or upsells
  • Optimized batch processing for performance on large sites
  • All file operations are limited to the WordPress uploads directory

Frequently Asked Questions (FAQ)

How does Safe Media Cleaner work?

Safe Media Cleaner scans your WordPress media library, uploads directory, and database references to detect unused, orphaned, and broken media files. Nothing is deleted automatically; you review the results before cleanup.

What is the difference between Regular and Deep Scan?

  • Regular Scan: Fast, focused scan that checks registered media library attachments, post content, and supported plugins. Ideal for routine cleanup.
  • Deep Scan: Comprehensive scan of all uploads, including unregistered files, theme files, plugin files, and custom post types. Suitable for large sites or full audits.

What is Broken Media Scan?

Broken Media Scan identifies media files that are missing, return errors, or are no longer used in posts, pages, custom fields, page builders, or widgets. It helps prevent broken layouts and missing images on your site.

What is Live Site Scan?

Live Site Scan analyzes your public-facing site (front-end) to detect media that is actually loaded and used. This ensures you don’t accidentally delete files actively used by page builders, shortcodes, or dynamic content.

Does Safe Media Cleaner delete all image sizes and thumbnails?

Yes. When a media item is deleted, all generated versions (thumbnails, medium, large, custom sizes) are deleted together. Files are first moved to the plugin trash folder before permanent deletion.

Can I restore files after deletion?

Yes. Media files deleted by Safe Media Cleaner are first moved to a temporary trash folder. You can restore them at any time before permanent deletion.

Which page builders and plugins are supported?

Safe Media Cleaner detects media usage across:

  • Gutenberg Blocks
  • Elementor
  • Divi Builder
  • WPBakery Page Builder
  • Advanced Custom Fields (ACF)
  • Meta Box
  • Pods
  • WooCommerce product galleries and variations
  • Sliders (Revolution, Smart Slider)
  • Widgets and navigation menus
  • Theme file references (Deep Scan only)

Is it safe for large sites?

Yes. Scans are processed in batches to prevent timeouts, and operations are optimized for large media libraries. Background processing ensures reliability even for sites with thousands of files.

Is Safe Media Cleaner secure?

Absolutely. All destructive actions are protected with WordPress capability checks and nonces. File operations are restricted to the uploads directory, with no external tracking or remote calls.

Can I use Safe Media Cleaner on multisite installations?

Yes. Safe Media Cleaner supports WordPress multisite. Each site is scanned independently, and media is managed per site.