Sajib Media Cleanup & Storage Manager

Description

Sajib Media Cleanup & Storage Manager helps WordPress administrators find unused media, duplicate images, orphan files and stale generated thumbnails before removing anything. It builds a reference index across WordPress content and metadata, supports Elementor, ACF and WooCommerce workflows, identifies preliminary unused and duplicate-unused media, and provides reference checks before cleanup; these checks are not a guarantee that every third-party or dynamically generated reference is discoverable.

Key features include:

  • Reference-aware Media Library audit.
  • Exact second-pass cleanup plans before destructive operations.
  • Final live verification immediately before cleanup.
  • Safety Vault delayed-purge hold with cancellation and fresh verification before permanent deletion.
  • Duplicate-unused detection using file hashes.
  • Safe orphan discovery in standard WordPress date-based upload folders.
  • Media Family inspection for original, generated and optimized variants.
  • Stale derivative auditing with current-reference protection.
  • Incremental scan fingerprints, storage analytics and audit history.
  • Background jobs designed for shared-hosting environments.

Sajib Media Cleanup & Storage Manager does not treat an unattached image as automatically unused. Candidates must pass the plugin’s verification workflow before they can become cleanup-ready.

Author

Developed by Mohamed Sajib.

Portfolio: sajib.dev.cv

Privacy

Sajib Media Cleanup & Storage Manager performs media analysis inside the WordPress site. The plugin does not require an external account and does not intentionally transmit media-library contents to the author.

Source Code

This plugin does not use compiled, minified, transpiled, or generated application code.

  • The distributed assets/admin.js file is the human-readable JavaScript source used directly by WordPress.
  • A matching source copy is also included at assets/src/admin.js.
  • The distributed assets/admin.css file is the human-readable stylesheet used directly by WordPress.
  • A matching source copy is also included at assets/src/admin.css.
  • PHP source is included in the plugin root and includes/.
  • No npm, webpack, bundler, minifier, transpiler, or proprietary build tool is required.
  • Rebuilding the distributed assets only requires copying source files unchanged: cp assets/src/admin.js assets/admin.js and cp assets/src/admin.css assets/admin.css.

All maintainable source required to inspect and reproduce the distributed assets is included in this plugin package.

Installation

  1. Upload the plugin through Plugins > Add New > Upload Plugin, or install it from the WordPress.org Plugin Directory after publication.
  2. Activate Sajib Media Cleanup & Storage Manager.
  3. Open Media > Media Cleanup Manager.
  4. Keep the recommended reference checks enabled.
  5. Run a media scan.
  6. Review the results before preparing an exact cleanup plan.
  7. Keep a current site backup before permanent cleanup operations.

FAQ

Does Sajib Media Cleanup & Storage Manager delete unattached images automatically?

No. Unattached does not mean unused. The plugin uses reference indexing, an exact cleanup plan and a final live verification layer.

Does it protect common builder and WooCommerce media references?

The scanner indexes WordPress content and metadata used by common builder and commerce workflows, including Elementor and WooCommerce references.

What is the Safety Vault delayed-purge hold?

Safety Vault is a delayed-purge hold. Verified candidates remain at their original upload paths while deletion is pending, so cancelling the hold requires no file restoration. Permanent purge runs only after another live reference and path-safety check.

Does the plugin send site data to an external service?

No telemetry or remote scanning service is required by the plugin. Media analysis runs inside the WordPress installation.

Can I permanently delete files?

Yes. Permanent cleanup is available only after the verification workflow and confirmation. Keep a recent backup before destructive operations.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Sajib Media Cleanup & Storage Manager” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.7.0-rc2 (development; not released)

  • Reworked SQL templates, identifier placeholders, filter binding and fingerprint commit ordering.
  • Added fail-closed database checks and complete attachment metadata validation.
  • Hardened final permissions, stale-derivative checks and UTC job timestamps.
  • Context-aware media ID extraction and isolated WordPress/MySQL tests added.
  • Added real WordPress/MySQL, browser, concurrency, compatibility and package acceptance coverage.

1.6.4

  • Excluded legacy HMG media-cleaner tables from custom reference discovery.
  • Prevents historical scanner/index data from falsely marking attachments as live website usage.
  • Improves cleanup accuracy on sites upgraded from earlier Media Guard/Harrington Media Guardian builds.

1.6.3

  • Rechecked the complete WordPress.org review package and hardened self-reference isolation.
  • Excluded all plugin-owned operational tables from custom website-reference discovery.
  • Skip filesystem symlinks during orphan discovery before they can become candidates.
  • Replaced remaining dynamic identifier SQL with WordPress identifier placeholders where applicable.
  • Restored the Media Family explorer button.
  • Reformatted distributed CSS and JavaScript for clearly human-readable source review.

1.6.2

  • Fixed delayed-purge integrity checks so an attachment’s own inventory metadata is not mistaken for frontend usage.
  • Tightened safe handling of missing orphan paths during purge.
  • Removed PHP error-suppression operators from filesystem reads and image inspection.
  • Improved AJAX checkbox normalization and admin output escaping.
  • Kept all WordPress.org review fixes from 1.6.1.

1.6.1

  • Renamed to place the unique Sajib identifier first and prepared the requested sajib-media-cleanup-manager slug.
  • Hardened all attachment-derived filesystem paths with uploads-directory containment and safe filename handling.
  • Replaced metadata-derived wildcard sibling matching with containment-checked directory enumeration.
  • Replaced direct file deletion calls with WordPress core file deletion after path validation.
  • Added consistent unslashing and sanitization for AJAX input.
  • Clarified Safety Vault as a delayed-purge hold rather than a physical file move.
  • Added explicit human-readable source and no-build documentation for directory review.

1.6.0

  • Renamed with a distinctive sajibsays identifier and new public slug.
  • Replaced the previous short internal prefix with the unique sajmc_ / SAJMC_ prefix.
  • Added strict uploads-directory containment checks for every attachment-derived filesystem path.
  • Reworked Safety Vault as delayed purge so it does not copy files into web-accessible storage.
  • Added human-readable JavaScript/CSS source copies and documented the no-build asset workflow.
  • Retained background-worker timeout recovery and bounded metadata scanning.

1.5.2

  • Added automatic stale-worker recovery after Action Scheduler/host timeouts.
  • Reduced builder-reference batch size and added a six-second soft execution budget.
  • Large Elementor/metadata payloads are scanned in bounded chunks.
  • Fingerprint writes are split into smaller transactions to reduce lock/timeout risk.
  • Existing valid scan progress can resume safely after updating.

1.5.1

  • Improved stale-derivative reference accuracy.
  • Separated self attachment metadata from authoritative frontend references.
  • Kept current page, template, option and active-code protections before derivative cleanup.
  • Prepared the plugin for WordPress.org distribution under GPL v2 or later.

1.5.0

  • Added Safety Vault quarantine and restore workflow.
  • Added post-cleanup integrity checks.
  • Added Media Family inspection.
  • Added incremental scan delta reporting.
  • Added stale derivative audit and cleanup workflow.