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.
by Aliyan Faisal · github.com/aliyanfaisal/delete-unused-images---custom-plugin · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/aliyanfaisal/delete-unused-images---custom-plugin/archive/refs/heads/master.zipDelete Unused Images - WordPress Plugin
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
- Upload the
afb-delete-unused-imagesfolder to your/wp-content/plugins/directory. - Activate the plugin through the 'Plugins' menu in WordPress.
- 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)