WP Manifestindependent plugin directory
manifest / media / delete-unused-images-wordpress-plugin

Delete Unused Images - Custom Plugin

Automatically deletes unused media images on a scheduled interval. This plugin helps keep your WordPress media library clean by removing images that are no longer linked to any posts, pages, or custom post types.

★ 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/aliyanfaisal/delete-unused-images-wordpress-plugin/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Description

Automatically deletes unused media images on a scheduled interval. This plugin helps keep your WordPress media library clean by removing images that are no longer linked to any posts, pages, or custom post types.

Key Features

  • Automated Cron Jobs: Scheduled intervals to check and delete unused images automatically.
  • Batch Processing: Handles large media libraries safely with a batch time limit (default 50 seconds) to prevent server timeouts.
  • Manual Trigger: Ability to start the scan process manually from the admin settings page, with complete stats and a stop button.
  • Dry Run Mode: Test the process to see which images would be deleted without actually removing any files.
  • Detailed Statistics: A comprehensive stats section to monitor the scan and deletion progress.
  • Logging System: Built-in logs for debugging and monitoring plugin activities.
  • Profile Check Caching: Added cache system for profile checks to improve performance.
  • Watchdog: Ensures the cron doesn't stop unexpectedly and added a continue button.

Installation

  1. Upload the afb-delete-unused-images folder to your /wp-content/plugins/ directory.
  2. Activate the plugin through the 'Plugins' menu in WordPress.
  3. Access the plugin settings via the WordPress Admin dashboard to configure intervals or run manual scans.

Debugging

The plugin includes a debug shortcode to test frontend URL fetching:

[afb_dui_debug_profile url="https://example.com"]

(Requires manage_options capability to execute)