[00] Subset Sizes, For developers
WP-CLI commands
Every wp subset image-resizer command in Subset Sizes and Sizes Pro, with its options, defaults and examples as wp help prints them.
Subset Sizes adds its commands under wp subset image-resizer. The Pro commands appear once Subset Sizes Pro is active with a valid licence. Run wp help subset image-resizer <command> on your site to see the same text there.
generate
Generates missing size files. Existing files are left alone. Sizes larger than an image are skipped, and WordPress serves the original for those.
wp subset image-resizer generate [--size=<sizes>] [--ids=<ids>]
| Option | Default | What it does |
|---|---|---|
--size=<sizes> | Every registered size | Comma-separated registered size names. |
--ids=<ids> | Every image attachment | Comma-separated attachment IDs. |
wp subset image-resizer generate
wp subset image-resizer generate --size=large,medium_large --ids=12,34
clean-orphans
Deletes size files that no registered size uses any more, and drops the metadata entries for sizes that are no longer registered. Originals, -scaled copies and image editor backups are never touched. Anything requested later is made again on demand.
wp subset image-resizer clean-orphans [--dry-run] [--ids=<ids>]
| Option | Default | What it does |
|---|---|---|
--dry-run | Off | Lists what would be deleted without deleting it. |
--ids=<ids> | Every image attachment | Comma-separated attachment IDs. |
wp subset image-resizer clean-orphans --dry-run
wp subset image-resizer clean-orphans
stats
Shows registered sizes, the size files on disk and their disk usage.
wp subset image-resizer stats [--format=<format>]
| Option | Default | What it does |
|---|---|---|
--format=<format> | table | Output format: table or json. |
self-test
Checks whether requests for missing size files reach WordPress. It requests a probe image under uploads from the site itself, the same test Site Health runs, and stores the result. If the web server answers missing files itself, sizes are created while pages render instead, until you add the server rule. See server configuration.
wp subset image-resizer self-test
settings
Lists, reads and changes the settings on the Settings tab. Only known names are accepted, and values are cleaned the same way the settings screen cleans them. A setting pinned by a constant in wp-config.php can’t be changed here either.
wp subset image-resizer settings list [--format=<format>]
wp subset image-resizer settings get <name> [--format=<format>]
wp subset image-resizer settings set <name> <value>
wp subset image-resizer settings reset [--yes]
| Subcommand | Options | What it does |
|---|---|---|
list | --format: table (default), json, csv or yaml | Lists every setting, its value and its source: default, saved, filter or constant. |
get | --format: plain (default) or json | Prints one setting’s value. |
set | None | Changes one setting. Booleans take true/false, yes/no, on/off or 1/0. Lists take a JSON array or comma-separated values. |
reset | --yes skips the confirmation | Removes every saved setting, so each goes back to its default. A setting pinned by a constant keeps the constant’s value. |
The settings are lazy_mode, kept_sizes, sync_on_request, async, max_dimension and rate_limit.
wp subset image-resizer settings list
wp subset image-resizer settings set kept_sizes thumbnail,medium
prewarm (Pro)
Visits the site’s pages now and creates the missing sizes they show. Pages come from the home page and the WordPress sitemaps. The command runs in the current process. To run it in the background, use the settings page instead.
wp subset image-resizer prewarm [--max-pages=<number>]
| Option | Default | What it does |
|---|---|---|
--max-pages=<number> | 500 | The most pages to visit. The default comes from the subir_pro_prewarm_max_pages filter. |
wp subset image-resizer prewarm
wp subset image-resizer prewarm --max-pages=50
audit (Pro)
Shows which sizes the front end uses, and deletes the files of unused ones. Sizes that Elementor or Bricks content uses are listed with the IDs of the posts using them, and never deleted.
wp subset image-resizer audit [--dry-run] [--delete]
| Option | Default | What it does |
|---|---|---|
--dry-run | Off | Measures what deleting the unused sizes would free, without deleting. |
--delete | Off | Deletes the files and metadata entries of unused sizes. |
wp subset image-resizer audit
wp subset image-resizer audit --dry-run
wp subset image-resizer audit --delete
formats (Pro)
formats backfill makes the AVIF and WebP copies that existing images are missing. New uploads get theirs in the background, so this covers images uploaded before Pro, or before a format was turned on. Only formats that are on in the Formats tab are made. It runs in the current process.
wp subset image-resizer formats backfill [--format=<format>] [--dry-run]
| Option | Default | What it does |
|---|---|---|
--format=<format> | Every format that’s on | Makes only this format: avif or webp. |
--dry-run | Off | Counts the missing copies without making them. |
wp subset image-resizer formats backfill
wp subset image-resizer formats backfill --format=webp --dry-run
formats settings reads and changes the Formats tab’s settings, with the same list, get, set and reset subcommands as settings.
placeholders (Pro)
placeholders generate builds the blur-up and dominant-colour placeholders of every image. Otherwise pages build them as images are shown, a few per request, and queue the rest. Both styles come from the same data, so switching style needs no rebuild. It runs in the current process.
wp subset image-resizer placeholders generate [--missing]
| Option | Default | What it does |
|---|---|---|
--missing | Off | Builds only images without a current placeholder. |
wp subset image-resizer placeholders generate
wp subset image-resizer placeholders generate --missing
placeholders settings reads and changes the Placeholders tab’s settings, with the same subcommands as settings.
sign (Pro)
Prints a signed transform URL: any size of an image, made on its first request. It’s the same URL Transforms::url() gives a theme. Unsigned or altered URLs are refused, so only URLs your site signed make sizes. It needs pretty permalinks.
wp subset image-resizer sign <image> [--width=<px>] [--height=<px>] [--fit=<fit>]
| Option | Default | What it does |
|---|---|---|
<image> | None | An attachment ID, its URL, its path under uploads (2026/09/photo.jpg) or its absolute file path. |
--width=<px> | None | Width in pixels. |
--height=<px> | None | Height in pixels. |
--fit=<fit> | scale | With both a width and a height: crop to fill them, or scale to fit inside them. |
wp subset image-resizer sign 42 --width=400
wp subset image-resizer sign 2026/09/photo.jpg --width=400 --height=300 --fit=crop
wp subset image-resizer sign https://example.com/wp-content/uploads/2026/09/photo.jpg --height=200
watermark (Pro)
watermark settings reads and changes the Watermark tab’s settings, with the same subcommands as settings.
wp subset image-resizer watermark settings list
wp subset image-resizer watermark settings set attachment_id 42
wp subset image-resizer watermark settings set sizes large,medium_large
wp subset image-resizer watermark settings set enabled true