WP Manifestindependent plugin directory
manifest / media / elinweb-unused-media-finder

Elinweb Unused Media Finder

WordPress plugin: find unreferenced media, see where each file is used, clean up safely (quarantine first).

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/ishadmehri/elinweb-unused-media-finder/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

فارسی

A WordPress plugin that finds unreferenced media, shows where each file is used, finds duplicate files, and cleans up safely with a reversible quarantine.

On a live site always quarantine first, never delete straight away, and take a backup before any deletion.

What it does

  • Scan: the database (posts, meta, options, terms, users, comments, plugin tables) and, optionally, the code of the active theme and plugins plus CSS/JS inside uploads.
  • Detection: URLs (with sizes, -scaled, WebP, URL-encoded, \u and HTML entities, NFD), ids (featured image, galleries, blocks, shortcodes), Elementor (loops, dynamic tags, V4), ACF/SCF, Meta Box, Pods, JetEngine, WooCommerce, Gravity Forms, Fluent Forms, WPForms, CF7, Smart Slider.
  • Live updates: after a full scan, saves in the admin are recorded without scanning again.
  • Media Library: a "Usage" column and filter in list and grid mode, and a dialog with every place a file is used.
  • Card or list view and a per-page choice (20, 40, 100, 200, 500) on the unreferenced tab; the choice is saved per user.
  • Duplicates: files with identical content uploaded more than once. Sizes are compared first, and only same-size files get an MD5, so it stays light on large libraries. Attachments sharing one file (media translations) are not duplicates, and only unreferenced copies can be selected.
  • Cleanup: unreferenced list with preview, quarantine with request logging, restore, keep, permanent delete; extra files on disk; unregistered image sizes.
  • Safety: attachments that share a file move together; a scan that reports a featured image as unreferenced is marked untrustworthy and quarantine and delete are refused.
  • WP-CLI: wp elinweb-unused-media-finder scan|status|unused|usage|quarantine|restore|delete|keep

Data and uninstall

No settings page. The plugin creates four tables (mtrk_refs, mtrk_paths, mtrk_files, mtrk_hashes), several mtrk_ options, the post meta _mtrk_quarantine and _mtrk_keep, and the user meta mtrk_per_page and mtrk_view. Uninstalling (not just deactivating) removes all of it; quarantined files are restored first. Request logs of quarantined files (time, referrer, user agent) stay in your own database.

Requirements

WordPress 6.0+ and PHP 7.4+ (only run on PHP 8.2 so far).

Languages

English (source) and Persian (languages/elinweb-unused-media-finder-fa_IR.po). To change a translation, edit the .po file and compile it:

wp i18n make-mo languages

Tests

Run them on a development site, not a live one (they clear the scan result):

wp eval-file wp-content/plugins/elinweb-unused-media-finder/tests/check.php

The others: live, cleanup, sizes, orphans, names, integrations (tests the installed plugins and fails for any that is missing), duplicates.

Releasing

scripts/release.ps1 reads the version from the plugin header, builds dist/elinweb-unused-media-finder-<version>.zip from HEAD, and with -Publish tags it and creates the GitHub release. The WordPress.org readme.txt and header version must be bumped together.

Roadmap

Open work and ideas are in ROADMAP.md.

License

GPL-2.0-or-later