Webangon Image Optimizer combines image cleanup, thumbnail regeneration, and WebP/AVIF conversion into one WordPress plugin. It gives site owners a single Media Library tool for reducing storage usage, improving image delivery, and keeping generated image files healthy. The plugin adds a tabbed admin page under Media > Image Optimizer and supports WP-CLI for large sites, scheduled maintenance, and developer workflows.
Scans image attachments and detects unused media while protecting images referenced throughout WordPress. Always run a dry scan first, review the result, and take a backup before deleting.
Regenerates selected registered image sizes across the Media Library. It can also delete old thumbnail files before rebuilding or remove all generated thumbnails while keeping the main image.
Converts Media Library images to WebP or AVIF using PHP GD. It can update attachment metadata and rewrite image URLs across posts, post meta including Elementor data, and options.
After activation, open:
`text
Media > Image Optimizer
`
The admin page includes three tabs:
`text
Image Cleaner
Thumbnails
WebP / AVIF
`
The plugin also adds an Optimize Image action link on the WordPress Plugins screen.
All commands use the shared namespace:
`bash
wp webangon-image-optimizer
`
Run a dry scan:
`bash
wp webangon-image-optimizer clean
`
Scan images older than 30 days:
`bash
wp webangon-image-optimizer clean –older-than=30
`
Run a deeper scan of custom fields and post meta:
`bash
wp webangon-image-optimizer clean –deep-meta
`
Protect images used only in revisions:
`bash
wp webangon-image-optimizer clean –include-revisions
`
Skip scanning widgets, theme options, customizer settings, and plugin options:
`bash
wp webangon-image-optimizer clean –skip-options
`
Set the processing batch size:
`bash
wp webangon-image-optimizer clean –batch=200
`
Delete unused images after confirmation:
`bash
wp webangon-image-optimizer clean –delete
`
Delete unused images without the confirmation prompt:
`bash
wp webangon-image-optimizer clean –delete –yes
`
Regenerate all registered thumbnail sizes for all image attachments:
`bash
wp webangon-image-optimizer thumbnails regenerate
`
Regenerate selected sizes:
`bash
wp webangon-image-optimizer thumbnails regenerate –sizes=thumbnail,medium,large
`
Delete old thumbnail files before regenerating:
`bash
wp webangon-image-optimizer thumbnails regenerate –delete-old
`
Regenerate from the full-size original image:
`bash
wp webangon-image-optimizer thumbnails regenerate –from-original
`
Regenerate specific attachments:
`bash
wp webangon-image-optimizer thumbnails regenerate –ids=12,34,56
`
Preview a thumbnail regeneration run without changing files:
`bash
wp webangon-image-optimizer thumbnails regenerate –dry-run
`
Delete all generated thumbnails while keeping the main image:
`bash
wp webangon-image-optimizer thumbnails purge
`
Also delete edit-backup files from cropped, rotated, or scaled images:
`bash
wp webangon-image-optimizer thumbnails purge –backups
`
Purge thumbnails for specific attachments:
`bash
wp webangon-image-optimizer thumbnails purge –ids=12,34,56
`
Preview a thumbnail purge without deleting files:
`bash
wp webangon-image-optimizer thumbnails purge –dry-run
`
Purge thumbnails without the confirmation prompt:
`bash
wp webangon-image-optimizer thumbnails purge –yes
`
Convert all image attachments to WebP:
`bash
wp webangon-image-optimizer convert –format=webp –quality=82
`
Convert all image attachments to AVIF:
`bash
wp webangon-image-optimizer convert –format=avif –quality=70
`
Delete old source files after successful conversion:
`bash
wp webangon-image-optimizer convert –format=webp –quality=82 –delete-old
`
Re-encode images already in the selected output format:
`bash
wp webangon-image-optimizer convert –format=webp –regen
`
Convert specific attachments:
`bash
wp webangon-image-optimizer convert –ids=12,34,56 –format=webp
`
Convert files and skip database URL rewriting:
`bash
wp webangon-image-optimizer convert –format=webp –skip-rewrite
`
Rewrite database URLs only, without converting files:
`bash
wp webangon-image-optimizer convert –format=webp –rewrite-only
`
Preview a conversion run without changing files or database rows:
`bash
wp webangon-image-optimizer convert –format=webp –dry-run
`
Run conversion without the confirmation prompt:
`bash
wp webangon-image-optimizer convert –format=webp –quality=82 –yes
<h3>Recommended Workflow</h3>imagewebp()
1. Take a full file and database backup.
2. Run Image Cleaner in dry scan mode before deleting anything.
3. Regenerate thumbnails after changing theme image sizes or after imports/migrations.
4. Convert to WebP first for broad compatibility, or AVIF when your hosting stack supports it and you want smaller files.
5. Test important pages, Elementor templates, product galleries, and image-heavy pages after conversion.<h3>Requirements</h3>
- WordPress 5.8 or newer.
- PHP 7.4 or newer.
- PHP GD withfor WebP conversion.imageavif()
- PHP GD withfor AVIF conversion.–dry-run
- WP-CLI for command-line usage.<h3>Safety Notes</h3>
- Deletion and conversion can permanently change files and database content.
- Usewhere available before live operations.–delete
- Keep original files unless you are confident the converted output is correct.
- Run large operations during low-traffic windows.
- Keep backups before using destructive options such as,–delete-old`, or thumbnail purge.