Install
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/carmopereira/carmo-media-fix/archive/refs/heads/main.zipLists every registered image size (system, theme and plugins) and lets you disable the ones you don't need generated on upload.
Description
This plugin adds a page under Settings > Media Crops with a table listing every image size (crop) registered on the site, grouped by origin: system (WordPress core), theme, and plugins.
Each row has a checkbox to disable that size. Once a size is disabled, WordPress stops generating it whenever a new image is uploaded to the media library — files that already exist are not deleted.
The page also includes:
- A total disk usage indicator for the
wp-content/uploadsfolder, with a button to recalculate it. - An "orphaned" image file detector (files inside
uploadsthat don't belong to any media library attachment, neither as the original nor as one of its generated sizes). This is informational only — nothing is deleted from the page. - Example WP-CLI commands to regenerate all image sizes (or just some of them, or only the ones that are missing, or only a specific folder).
The plugin also registers the wp carmo-media-fix delete-orphans command, which lists (by default) or deletes (with --yes) the detected orphaned files.
Note: since WordPress doesn't store which theme or plugin registered a given size via add_image_size(), the "theme" vs "plugin" distinction is made with a heuristic (based on when each size is registered during the WordPress bootstrap) and may, in rare cases, misclassify a size.
Frequently Asked Questions
Does disabling a crop delete the images that were already generated?
No. Disabling a size only prevents it from being generated on future uploads. Files already created in the past remain on the server until you delete them yourself (see the WP-CLI section on the plugin page).
How do I delete and regenerate images after disabling a crop?
The plugin page (Settings > Media Crops) shows several wp media regenerate examples, including how to regenerate only some sizes or only a specific folder/date.
Is it safe to delete the files flagged as "orphaned"?
Always take a full backup (database + wp-content/uploads) first. The list may include images that were placed manually in the uploads folder without going through the media library, so double-check before deleting. The wp carmo-media-fix delete-orphans command runs in dry-run mode by default — it only actually deletes with the --yes flag.
Is the "theme" vs "plugin" distinction always accurate?
Not guaranteed 100%. WordPress doesn't store who called add_image_size(), so the plugin uses a heuristic based on when each size gets registered during the WordPress bootstrap.
Changelog
1.0.5
- Use
wp_delete_file()instead ofunlink()when deleting orphaned files, per WordPress coding standards. - Fixed "Tested up to" version format (major.minor only).
1.0.4
- Settings page listing every image size (system, theme, plugins) with a checkbox to disable each one.
- Uploads folder disk usage indicator, with a recalculate option.
- Orphaned image file detection on the page, with a warning before any destructive action.
- WP-CLI command
wp carmo-media-fix delete-orphansto list (dry run) or delete orphaned files. - WP-CLI command examples to regenerate all, some, or only the missing sizes.