HMDG Image File Search and Replace
A WordPress admin plugin that identifies and removes unwanted image filename suffixes (_converted, -converted, -scaled, etc.) appended by WP Engine, WP Smush, Imagify and similar tools. Scans the entire WordPress database, renames files, updates DB references, and registers 301 redirects.
by HMDG · github.com/felmerald-hmdg/hmdg-image-file-name-search-and-replace-bulker · 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/felmerald-hmdg/hmdg-image-file-name-search-and-replace-bulker/archive/refs/heads/master.zipVersion: 1.0.1 | Author: HMDG | Requires: WordPress 6.0+, PHP 8.0+
What It Is
A WordPress admin plugin that identifies and removes unwanted image filename suffixes — _converted, -converted, -scaled, -scaled-converted, and all variations — that are silently appended by WP Engine Smart Image Optimisation, WP Smush, Imagify, and similar tools during upload or conversion.
Example:
- Before:
https://disc.co.uk/wp-content/uploads/2025/04/Leg-2_converted.avif - After:
https://disc.co.uk/wp-content/uploads/2025/04/Leg-2.avif
What It Does
-
Scans every location where image URLs appear in the WordPress database:
- Post content (Classic Editor, Gutenberg blocks)
- Post meta — including Elementor JSON (escaped slashes) and Divi meta
wp_options(theme customiser, widget data, site settings)- Attachment GUIDs and
_wp_attached_filerecords
-
Displays a results table showing:
- The original (broken) image URL
- The clean URL it will become after fix
- Every page/post where the image is referenced (with links)
- File status (whether the clean file already exists on disk)
-
Removes the suffix safely:
- Renames the physical file on the server
- Runs targeted
REPLACE()SQL on every affected table - Updates the Media Library attachment record (
guid+_wp_attached_file)
-
Registers a 301 redirect from the old URL to the new one — so previously cached links, sitemaps, or external references never hit a 404.
-
Exports scan results to a properly formatted Excel (
.xlsx) file with columns:- Scanned Image URL
- Redirected (Clean URL)
- Pages / Posts That Have This Image
-
Downloads itself as a ready-to-install plugin ZIP via the dashboard button.
Why It Was Built
HMDG manages 500+ WordPress sites hosted on WP Engine and Flywheel. The hosting platforms auto-convert images to AVIF/WebP and append _converted or -scaled-converted to filenames. When clients supply their own images with specific filenames for SEO or URL-consistency reasons, these suffixes break expected URLs across Elementor, Divi, post content, and site options simultaneously.
This plugin automates what would otherwise be 70+ manual edits per site.
Installation
- Download
HMDG-Image-Search-Replace-v1.0.1.zipfrom the plugin dashboard - Go to WP Admin → Plugins → Add New → Upload Plugin
- Upload the ZIP and click Activate
- Navigate to Image Fix in the WordPress sidebar
Usage
- Click Scan Site — the plugin scans the entire database
- Review the results table
- Click Remove on individual rows, or Remove All to fix everything in bulk
- Click Export to Excel to download a
.xlsxreport - 301 redirects are registered automatically — no extra configuration needed
Important Notes
About the "Filename" Field in Edit Media
The Filename input visible in WP Admin → Media → Edit Media is added by Rank Math SEO (not WordPress core). When Rank Math renames a file it correctly updates the attachment record but does not update Elementor JSON, Divi meta, post content, or site options. This plugin handles all of those.
File Safety
- If the clean file already exists on disk, the plugin skips the rename and just updates DB references
- If the original file is missing from disk, DB references are still updated and a 301 is registered
- No files are ever deleted — only renamed
Suffix Patterns Covered
| Pattern | Example |
|---|---|
_converted |
Leg_converted.avif → Leg.avif |
-converted |
Leg-converted.avif → Leg.avif |
_scaled |
Leg_scaled.jpg → Leg.jpg |
-scaled |
Leg-scaled.jpg → Leg.jpg |
-scaled-converted |
Leg-scaled-converted.avif → Leg.avif |
_scaled-converted |
Leg_scaled-converted.avif → Leg.avif |
-scaled_converted |
Leg-scaled_converted.avif → Leg.avif |
_scaled_converted |
Leg_scaled_converted.avif → Leg.avif |
-scaledconverted |
Leg-scaledconverted.avif → Leg.avif |
Changelog
v1.0.1
- Added 301 redirect registration (old URL never 404s)
- Added Excel
.xlsxexport (native ZipArchive, no dependencies) - Added plugin self-download as installable ZIP
- Added Rank Math filename field explanation in dashboard
- Added CSV fallback if ZipArchive unavailable
v1.0.0
- Initial release
- Full database scanner (post content, postmeta, options, attachments)
- Elementor JSON double-pass (escaped slash support)
- Divi meta scanning
- Individual and bulk remove actions
- Bootstrap 5 + vanilla JS UI