Skip to main content

WPStack

Free WordPress plugin

Mediachecker

Audit WordPress media safely with seven-signal usage detection, duplicate discovery, protected batch cleanup, automatic backups, and optional AI media tools.

About the plugin

Mediachecker is a security-first WordPress media library auditor for administrators who need to identify unused attachments, reclaim storage, and improve media quality without risking accidental data loss. It checks every attachment against seven independent reference signals before classifying it as used or orphaned.

Cleanup actions are re-verified at deletion time, recent uploads are protected by default, and automatic metadata or ZIP backups make changes recoverable. Mediachecker also detects exact and visual duplicates, exports audit results, schedules recurring scans, and provides optional AI-assisted alt text, categorization, and cleanup recommendations.

What it helps you do

Seven-signal media reference detection

  • Checks attachment parent relationships through post_parent.
  • Finds featured images, WooCommerce galleries, ACF values, and other attachment IDs stored in post meta.
  • Parses WordPress gallery shortcodes for referenced media IDs.
  • Reads Gutenberg image, gallery, and related block JSON.
  • Matches full URLs, filenames, and generated size variants in content, widgets, options, and files.
  • Scans theme templates, template parts, included PHP files, and stylesheets.
  • Inspects serialized sidebar-widget configurations.
  • Protects recent uploads through a configurable safety window that defaults to 30 days.

Safe unused-media cleanup

  • Filters, searches, and selects orphaned media for batch actions.
  • Supports deletion or detachment without forcing a single cleanup strategy.
  • Re-verifies references immediately before deleting anything.
  • Includes dry-run mode so administrators can preview a cleanup.
  • Requires explicit confirmation and an opt-in force flag to bypass recent-upload protection.
  • Displays file size and image dimensions to support informed decisions.

Automatic backup and restoration

  • Exports attachment ID, title, filename, URL, MIME type, parent, date, metadata, and backup timestamp to JSON.
  • Can package the original media files with metadata in a ZIP archive.
  • Protects backup storage with access-denial and directory-silencing files.
  • Restores attachment records, reconnects files, and regenerates WordPress attachment metadata.

Duplicate discovery

  • Finds filename collisions when the same filename has been uploaded more than once.
  • Uses MD5 content hashing to identify byte-identical files under different names.
  • Uses perceptual hashing to detect visually similar images entirely on the server.
  • Caches duplicate results to avoid unnecessary repeated work.

Optional AI media tools

  • Generates descriptive, accessibility-focused image alt text through an OpenAI-compatible vision API.
  • Categorizes media as photos, screenshots, logos, illustrations, icons, documents, graphics, infographics, charts, textures, or other types.
  • Produces cleanup confidence scores with plain-language reasoning.
  • Works with OpenAI, OpenRouter, or a compatible local vision endpoint.
  • Keeps visual duplicate detection available without any API key.

Reporting and continuous monitoring

  • Exports scan results as CSV with attachment IDs, titles, paths, URLs, dates, sizes, and MIME types.
  • Filters exports by used or unused status.
  • Runs scheduled scans hourly, daily, or weekly through WP-Cron.
  • Sends email notifications when orphan counts cross a configured threshold.
  • Offers exclusions for MIME types and upload directories.

Security and accountability

  • Requires WordPress nonces for every AJAX action.
  • Restricts scanning and cleanup to users with administrator capabilities.
  • Sanitizes IDs, text fields, booleans, API settings, and other inputs.
  • Escapes rendered content throughout the administration interface.
  • Records every deletion, detachment, and restoration with its timestamp, user, action, and details.
  • Caps the activity log to prevent unbounded option growth.

Plugin screenshots

Installation

  1. Download mediachecker-2.2.0.zip.
  2. In WordPress, open Plugins > Add New Plugin > Upload Plugin.
  3. Select the ZIP, install it, and activate Mediachecker.
  4. Open Media > Mediachecker. The first scan runs automatically.
  5. Review the Unused Media tab and use dry-run mode before deleting anything.
  6. Keep the recent-upload protection enabled unless there is a specific reason to override it.
  7. Configure scheduled scans, notifications, exclusions, and optional AI tools from Settings.

Changelog

2.2.0

  • Added AI alt-text generation through an OpenAI-compatible vision API.
  • Added image categorization and cleanup-confidence recommendations.
  • Added server-side visual duplicate detection using perceptual hashing.
  • Added the AI Tools dashboard tab and provider settings.
  • Corrected Mediachecker settings-page asset loading.
  • Corrected AI feature styles that were nested inside a responsive media query.
  • Replaced decorative gradients and glass effects with a cleaner WordPress-native interface.
  • Reduced CSS size by removing unnecessary visual effects.

2.1.0

  • Added seven-signal reference detection, recent-upload protection, and deletion-time re-verification.
  • Added JSON and ZIP backups, duplicate detection, CSV exports, activity logging, scheduled scans, and email notifications.
  • Added the About guide, plugin-row links, activation guidance, caching, and security hardening.

2.0.0

  • Initial release with media-library scanning and unused-attachment detection.

Support and usage notes

Unused-media classification should be reviewed before deletion, especially on sites with custom themes or plugins that store references in non-standard formats. Dry-run mode, recent-upload protection, deletion-time re-verification, and backups should remain enabled for production cleanups. AI alt text, categorization, and confidence scoring require a compatible vision API key; visual duplicate detection does not.

Related reading: How to find and remove unused WordPress media safely and the AI alt-text workflow.