Codebeans Unused Image Finder

Description

Codebeans Unused Image Finder checks every image in the Media Library and marks it Used or Unused, with links to the exact places each used image appears.

It checks:

  • Posts, pages and custom post types: block editor images, HTML, srcset, CSS backgrounds, shortcodes, galleries, featured images.
  • Page builders: WPBakery (single image, gallery, media grid), Elementor, Beaver Builder and builders that store JSON, serialized or base64-encoded data.
  • ACF image, gallery and file fields, Meta Box / Pods / CMB2 style fields, SEO social images, WooCommerce product galleries.
  • Site logo and icon, the active theme’s settings, and widgets placed in a widget area.
  • Category, tag and user profile images.
  • Gallery, slider and builder plugin tables.
  • Files of the active theme.
  • The live pages of the site and their stylesheets.

Trashed posts, old revisions, inactive widgets and settings of inactive themes do not count as use.

The plugin only saves a status on each image. It never deletes or changes posts, pages, images or settings.

For developers

  • unimfi_crawl_limit – maximum number of live pages checked (default 5000).
  • unimfi_table_pattern – regular expression for the plugin tables that are scanned.
  • unimfi_shortcode_image_atts – add shortcode attributes that hold image IDs.

The plugin only requests pages of your own site (loopback requests) and does not contact any external service.

Screenshots

Installation

  1. Go to Plugins Add New Plugin Upload Plugin, choose the zip and click Install Now, then Activate.
  2. Go to Media Library and click Scan now in the Codebeans Unused Image Finder box.
  3. Click Show unused only, select all, and choose Check usage from Bulk actions to double-check.
  4. Click Download unused list (CSV) for a report.

Before deleting any image, take a full backup and check a few images by hand. Delete in small batches.

WP-CLI:

wp unused-images scan
wp unused-images scan --skip-crawl
wp unused-images scan --skip-drafts

FAQ

Does this plugin delete my images?

No. It only saves a Used / Unused status on each image.

An image I use shows as Unused. What should I do?

Click Check usage on it. The report shows where it was found, or why it does not count. If it is used outside the website (emails, social media), click Mark as used.

What can it not detect?

Images used outside the website, images loaded only by JavaScript whose ID or path is not stored in the database, and images moved to a CDN that are no longer referenced by their WordPress path.

The box says live pages could not be loaded.

The server blocks requests to itself (loopback requests). The database and theme checks still run. Ask your host to allow loopback requests, or use WP-CLI.

What happens when I delete the plugin?

All saved statuses, “used” marks and temporary scan files are removed. Images are not touched.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Codebeans Unused Image Finder” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

2.4.4

  • Live pages are now fetched through the WordPress HTTP API (wp_remote_get), so proxy settings and HTTP filters apply.
  • Usage details no longer show the titles of posts, terms, user profiles or settings that the current user is not allowed to see.

2.4.3

  • Renamed the plugin to Codebeans Unused Image Finder. New slug and text domain: codebeans-unused-image-finder.

2.4.2

  • Simpler database query in Check usage.

2.4.1

  • Simpler database query for gallery and slider plugin tables.
  • Removed the Plugin URI and Author URI headers.

2.4.0

  • First WordPress.org release.
  • New unique “unimfi” prefix for all code and stored data. Results from earlier versions are moved over automatically.
  • Scan progress is stored in the database instead of files in the uploads folder. The old folder is removed.
  • Security hardening: escaped output and prepared database queries throughout.
  • Requires WordPress 6.2 or later.

2.3.0

  • WPBakery support: vc_media_grid, vc_gallery, vc_single_image and any attach_image / attach_images field.
  • Fixed file names with a double extension being matched to a different image.
  • Fixed images being counted twice when they have duplicate metadata rows.
  • Code reorganised into the standard plugin structure (classes, separate CSS and JS, uninstall.php).

2.2.0

  • Detects images in theme resizer caches, custom crop names, migrated folders, custom uploads folders, Envira / FooGallery galleries, base64-encoded builder data and edited images.
  • Bulk Check usage.

2.1.0

  • Instant updates when a featured image is set or a post is saved.
  • Check usage report.

2.0.0

  • Scan in steps with progress and resume, live page check, theme files, plugin tables, Mark as used.

1.0.0

  • First release.