Guides

Iminify WordPress plugin

Connect a WordPress site to your Iminify account: what connecting does, what the site sends, the settings its uploads follow, and the calls the plugin makes.

The Iminify WordPress plugin sends the images in your media library to Iminify and writes the smaller files back. This page covers connecting a site to your account, what the site sends, the calls the plugin makes, and its commands and hooks, for anyone who wants to know exactly what runs on their site.

Connecting a site

The plugin needs an Iminify account, and it sends nothing before you connect it. Connecting takes three steps, and the site's key never passes through your browser:

  1. You press Connect in the plugin. Your WordPress server asks Iminify for a pairing with the site's home address and name, and gets back a link.
  2. The plugin opens the link, a page on iminify.com. Sign in there, or create a free account by email or with Google, GitHub, Microsoft or Apple. If you sign up by email, confirm your address from the email we send: the link brings you back to the page, on this device or any other.
  3. Check the site's address on the page and press Connect the site. Your WordPress server then collects the site's key from Iminify on its own, within a minute, and we email you that the site was connected.

A pairing waits 15 minutes for you to approve it, 60 while a new account still has to confirm its address, and the plugin then has 15 minutes to collect its key. If the page says it expired, press Connect in the plugin again.

Connect only a site you run. If a page on iminify.com asks you to connect a site you didn't press Connect in, press This isn't my site. If a site was connected that shouldn't have been, the email we send names it, and Disconnect in Settings, Sites stops its key.

An agency can also add a site in Settings, Sites and paste its key on the plugin's page in WordPress, Settings, Iminify, or set it in wp-config.php:

PHP
define( 'IMINIFY_API_KEY', 'the site key' );
define( 'IMINIFY_HIDE_ACCOUNT', true );

A key set in wp-config.php can't be changed or disconnected from the plugin's page. The second line, which only works with the first, keeps your account's plan and daily counts off that page, so a client running the site sees its settings without seeing your account. Every site is listed in Settings, Sites with its settings and what it has saved, and Disconnect stops its key at once.

A multisite network

A super admin activates the plugin for the network and connects the whole network once, under Network Admin, Settings, Iminify. The steps are the same, and the page on iminify.com says it's a network before you press Connect the network. An agency adding one in Settings, Sites ticks This is a multisite network, adds the network's main site, and pastes its key under Network Admin, Settings, Iminify or sets it as IMINIFY_API_KEY, which on a network is the network's key. With the plugin activated site by site instead, each site connects on its own.

Each site of the network then joins by itself the first time it needs Iminify. The plugin sends the site's home address and name with the network's key, and gets back a key made for that site alone. From then on the site calls with its own key, from its own address, like any connected site. It starts with the network's settings, keeps its own after that, and its uploads count on your plan like any other site's. We don't email you as each site joins: Settings, Sites lists them under the network.

  • A network holds up to 50 sites, its main site included. A site you disconnect keeps its place until you remove it in Settings, Sites. A network with more sites connects the rest one at a time, each from its own dashboard.
  • A site joins only if your account doesn't already have it connected on its own or in another network, since a new key would stop the one it has. To move such a site into the network, disconnect it in Settings, Sites first.
  • A site can connect to an account of its own from its own Settings, Iminify page instead, and then never uses the network's key.
  • Disconnecting the network, in Settings, Sites or from the network admin, stops every one of its sites' keys too. Disconnecting one site, here or on its own page, stops only that site's key. The plugin doesn't ask the network for a new one by itself, but someone on that site can press Join the network, so to stop a site for good, disconnect the network. Adding the network again keeps it a network, and its sites join again by themselves: to make its main site a site of its own, remove the network in Settings, Sites first.
  • Turning the plugin off for the network, or deleting it, does it on every site. Deleting it stops the network's key once, which stops every key its sites joined with.
  • A network's sites share one free trial of Pro, as a single site's addresses do. Once an account on its trial sends images from any of them, a later trial account gets the free plan's numbers on every site of the network.

What a site can do

A site's key opens only that site's own calls: its settings, its uploads, the estimate on its bulk page and the audits of its own pages. It also reads the figures the plugin shows: your plan, today's counts, and how many images Iminify has optimized and how many bytes it saved, for the site and for your whole account. It can't list your images, read your scans or reports, or call any other part of the API, the MCP server included, so a site that was broken into reaches nothing else on your account. Its uploads and audits count on your plan, the same as the website's and the API's.

Each upload is sent as an upload group: the image once, with the sizes WordPress keeps of it, counted as one image. A connected site's groups follow the site's settings on iminify.com, never what the plugin asks for: Iminify makes the main image and the sizes the site picked, applies its level, formats, maximum width and size limit, and deletes the group once the plugin has saved the files. There are three exceptions. One is level: when you optimize one image again at another level from the media library, its group names that level, and when an image goes for a format or a size it lacks, its group names the level the image already has. Another is keep_dimensions, which the plugin sends for a file from another folder: its group of one output keeps its width and height, so the maximum width and size limit leave it alone. The third is output_format, for an image another optimizer converted to WebP or AVIF: the plugin sends the JPEG that optimizer kept, and every output comes back in the image's own format, with an AVIF copy beside a WebP one when your site makes AVIF. The plugin sends the original you uploaded, or WordPress's -scaled copy when the original is larger than your plan's file size.

A theme and its plugins can register more sizes than one group makes. Then Iminify makes the main image and as many sizes as the group rules allow, in the order WordPress lists them: at most 30 sizes counting the main image, 12 of them cropped, none cropped past 2,560 pixels on its longer side, and together at most 6 times the original's pixels. The rest stay as WordPress made them.

The plugin also sends its home address with every call, in the Iminify-Site header. A call from another address, like a staging copy of the site, is refused with site_moved and does nothing. The plugin then offers to connect the copy as a site of its own, or to move the connection to where it now runs.

The settings

Setting What it does
optimize_on_upload Send new uploads as they arrive.
level The compression level, smart unless you choose another.
webp, avif Make a WebP or an AVIF copy of every size beside it. A copy that comes out larger than its size isn't kept.
max_width Shrink the main image to this width, from 640 to 65535 pixels, keeping its shape. The other sizes stay as WordPress made them. null keeps its width.
size_limit Fit the main image and its copies under this many kilobytes, at least 5 and at most your plan's file size: Iminify lowers the quality first and shrinks the image only if that isn't enough. The main image keeps its format, so a PNG or a GIF has no quality to lower and only its WebP and AVIF copies are fitted, and an animation is never fitted. null sets no limit.
keep_metadata Keep the image's metadata (EXIF) instead of removing it.
alt_text, alt_text_language Write an AI alt text for each image that has none, in this language (a code from alt_text_languages in GET /site, en unless you choose another). Off unless you turn it on, because a small copy of each image then goes to Anthropic. Each counts one against your AI alt texts for the day, and an alt text you wrote yourself is never replaced. It applies as images are uploaded; for the ones already in your library, ask for it from an image's panel, on Media, Bulk Optimization, or with wp iminify alt-text.
sizes The WordPress sizes to optimize, by name, at most 30: letters, digits, dots, hyphens and underscores. The main image is always optimized. null optimizes every size, and an empty list only the main image.

The calls

Every call but the two that connect a site carries the site's key as Authorization: Bearer <key>, its home address in Iminify-Site, and its version in Iminify-Client (wordpress/1.2.0). Answers and errors take the API's shape, {"data": ...} and {"message": ..., "code": ...}; the errors page lists every code.

Call What it does
POST /connect/start Opens a pairing. Takes url, the site's home address, and name, and network (true) to connect a multisite network through its main site. Answers pairing, secret, connect_url and expires_at, the last moment the pairing can give a key.
POST /connect/claim Collects the site's key once you approved: pairing and secret. Answers key, given out once. Until you approve, it answers pairing_pending: ask again every few seconds, and stop at the key, at pairing_closed (the pairing can't give one any more) or at expires_at.
GET /site The site's settings, alt_text_languages (each language alt text can be written in, as a code and a name), alt_text_source (side, the longest side the model looks at, and max_bytes and max_side, the most a small copy sent for an alt text can have), your plan, max_file_size (the largest image your plan takes, in bytes), usage (images, files, AI alt texts and page scans, each with used, remaining and resets_at), stats (site and account, each with images, the images Iminify has optimized, an upload counted once, and bytes_saved, the bytes the files it wrote over shed, refreshed every few minutes), next_batch_at when today's images or files are spent, minimum_version, message, and network: null for a site of its own, or for a network and each of its sites, main (whether this is the network's main site), sites and max_sites. With ?waiting= (attachments) and waiting_files= (their files), it adds an estimate of the days the bulk run takes, and the plans that would take fewer.
PATCH /site Changes any of the settings above, and name.
POST /site/import Reads another image optimizer's settings as the site's: plugin (imagify, ewww, shortpixel, smush, tinypng, elementor, converter, optimole, modern-formats or litespeed), settings (that plugin's options by name, as WordPress keeps them, with only the keys that hold image settings: never its own API key or token) and sizes (the names of the image sizes the site registers). Answers settings, the site settings they match, only the ones it could read, and backups: whether that plugin kept backups (true or false), or null when it has no such setting. It changes nothing: send the settings back with PATCH /site to keep them.
POST /site/alt-text An alt text for an image optimized earlier: a small copy of it, as the multipart file, within alt_text_source's bounds (a 422 past them). Refused with site_alt_text_off while the setting is off. It's written in the site's language and counts one of your AI alt texts for the day, while bytes already described cost nothing and answer the text at once. Answers id, status (pending, written or failed), language and text.
GET /site/alt-text/{id} That request as it stands: ask every few seconds until status isn't pending, then the text is yours to save. The request is deleted a day after it was made.
POST /site/audits Audits one of the site's own pages, as a page scan does: url, an address on the site's host, its www. name included. One on another host, or with a login in it, is refused with audit_off_site. It counts one of your page scans for the day, and compresses nothing and writes no alt text, since the site's own images reach Iminify through its uploads. Answers the audit, queued, to poll.
GET /site/audits The site's latest audits, newest first, each with id, url, status, done, problem, images_found and created_at.
GET /site/audits/{id} One audit: ask every few seconds until done. Then rendered (whether a browser opened the page), findings (how many images have each finding) and images, every image address the page had, in its order: what the browser measured (format, bytes, natural_width, natural_height, rendered_width, rendered_height, above_fold, largest_paint, alt, wasted_bytes), serve_width for an oversized image (twice the width it's shown at), and findings, each with its code, the fix the plugin offers (smaller_size, add_dimensions, write_alt_text, load_at_once, load_lazily or prioritize), a label and a message. A page that couldn't be read has a problem, a code with English message: blocked (the site turned the scanner away: a firewall or a bot check, and the message says how to let it through), not_found, unavailable, redirected (the page sent the scanner to another site, which an audit doesn't follow) or unreachable. A page whose address answers with a redirect to another host fails, so an audit reads pages that load on the site's host.
POST /site/move Moves the connection to the address in Iminify-Site, after a site_moved.
POST /site/sites A network's key only, from the network's own address: adds one of its sites. Takes the site's url and name. Answers key, the site's own, given out once, and site. A site already in the network gets a new key, and its old one stops working. Refused with network_required for a site's key, network_full, and site_connected_elsewhere.
DELETE /site Disconnects the site: its key stops working, and it stays listed in Settings, Sites. A network's disconnects its sites too. The plugin also sends it when you delete the plugin from WordPress, unless the key is set in wp-config.php.
POST /groups and the group calls The site's uploads, as the upload groups page describes them. A site's group also takes keep_dimensions (true keeps its main output at the size declared, leaving out max_width and size_limit) and output_format (webp or avif: each output is made in that format in place of the source's, and answered as original). A site's group gets an alt text only when alt_text is true and the site's own setting is on, in the site's language, whatever the request names, and alt_text in its answer reads written a few seconds after its files, so keep the group until then (one whose main output failed stays pending, since its text waits for that output, so stop there). A site's key finds only the groups its own site opened.

message is null, or a code with English text the plugin shows or translates:

  • update_required: the plugin is older than version 1.0.0, and should be updated before it sends anything more.
  • day_spent: today's images or files are used up, until next_batch_at. The text names a plan or the trial that would carry on.
  • site_trial_used: the account is on its free trial of Pro, and this site already had a trial on another account, so its uploads count on the free plan's numbers here.

The calls take the API's limits, and the two that connect a site have their own: a site's address opens a few pairings an hour, and a wrong secret counts against the address it came from. A network asks to add a site at most twice as many times an hour as it can hold sites.

An image's panel

Each image's panel in the media library says where it stands and what optimizing saved across its files. Compare with the original opens the original the image was made from beside the file Iminify wrote, on one picture with a line you drag, or move with the arrow keys, and beside each WebP and AVIF copy, with the size of each. It's offered while the original is on your server: the plugin's backup, or the original WordPress keeps beside a large upload's -scaled copy. When the image carried Content Credentials, the panel says so and whether they say generative AI made it: the files Iminify wrote leave them out, and the backup of the original keeps them.

The settings page shows what Iminify has saved so far, for the site and for your whole account: the images optimized, an upload with all its sizes counted once, and the bytes the files it wrote shed.

What an image can lack

An optimized image lacks a format when your site asks for it now and its group wasn't asked for it, as when you turn on avif after optimizing your library. A copy Iminify left out for coming out larger than its size isn't missing, since another run wouldn't make it either. It lacks a size when your site sends it now and the image wasn't made with it, as when a theme registers a new one.

Media, Bulk Optimization makes them for the whole library, and an image's row and panel in the media library make them for that image. Either way the image goes again from its original and counts as one more image, with a file for every output in every format your site asks for. Its other files stay as they are unless Iminify makes them smaller. An image with no original left, because backups were off, can't be sent, and the page says how many there were.

Other folders

Media, Other Folders optimizes the images outside the media library, such as your theme's. Choose the active theme, its parent, or any folder inside wp-content by its path there, like themes/your-theme/assets. The plugin looks through it and lists every JPEG, PNG, WebP and GIF it finds, with what each one can do.

  • In place, at its own size. Each file goes to Iminify on its own, without sizes, and the file Iminify sends back takes its place under the same name, with its WebP and AVIF copies beside it. Its group asks to keep its width and height, so max_width and size_limit never touch it: a theme's layout can depend on an image's exact size.
  • Backups. With backups on, the original goes to uploads/iminify-backup-folders, at its path in wp-content. A file restores from there, one at a time or all at once on the bulk page.
  • Changed files. The plugin looks through the folders again after a theme or plugin update, and when you press Look for new and changed images. A file that no longer has the bytes the plugin wrote reads as not optimized, and is never restored over, since its backup is the old picture's.
  • What it leaves out. The uploads folder, the plugin's own folder, folders other tools fill with copies, caches or backups (such as cache, ewww and uploads-webpc), hidden folders, node_modules and vendor, links to other places, and copies like photo.jpg.webp.
  • On a network. Every site shares wp-content, so the main site chooses the folders and optimizes each file once for all of them.

Media, Bulk Optimization optimizes, sends again or restores all of them in a run of their own, the same way as the library's. Each file counts as one image.

Page audits

Media, Page Audit has Iminify open one of your site's pages as a visitor would and measure every image it shows. Pick the home page, one of your latest pages, or any other address on your site, and press Scan. An audit usually finishes within a minute, and each one counts as one of your page scans for the day.

Each image the page showed is listed beside the image and size in your media library it is, a WebP or AVIF copy beside the size it was made from, and an image WP Offload Media serves from its bucket beside its own when the bucket keeps WordPress's year and month folders, as WP Offload Media does unless that setting is off. Under it is what slows the page down, with the fix: an image more than twice as wide and tall as the space it fills, one without width and height, one with no alt text, one loaded lazily in the first screen or straight away below it, and the largest image in the first screen when the browser doesn't fetch it first. An image that isn't in your library, such as a theme's, is listed by its address.

Beside each image from your library, the audit offers what fixes it:

  • Optimize, for an image the plugin hasn't optimized yet, once for each image however many of its sizes the page loaded.
  • Write alt text with AI, for an image with no alt text, once alt_text is on. While it's off, the audit links to the setting. An image that translations share has an alt text in each language, so you write it on the translation the page shows, in its edit screen. Iminify writes no alt text for an SVG or AVIF file.
  • For an image more than twice as wide as its space, the size to choose instead, from those the editor offers, in the image's shape: the largest at least as wide as the page shows it and at most twice that, or, when there's none, the narrowest wider than that. When the page's own content holds the image, select it in the editor and choose that size under Resolution; the audit links to the page's edit screen. Otherwise your theme, a template or a widget shows it, and the size is chosen there.

When images from your library on the page lack their width and height, or the alt text they have in the library, a note above the list offers Fill them in on every page, which turns on the setting described under Serving WebP and AVIF.

An audit shows the page as Iminify saw it, so after a fix, scan the page again to see it.

When a firewall or a bot check turns the scanner away, the audit says so and how to let it through for a moment, often by turning Cloudflare's Bot Fight Mode off. An address on another site is refused, and a page that redirects, or that a script sends, to another site fails.

To have every page of your site audited each week, set up a weekly site check on iminify.com from a crawl of your sitemap; the audit screen links there. It comes with Pro, Max and the free trial of Pro.

Serving WebP and AVIF

The copies reach your visitors in one of these ways, which you choose on the plugin's settings page under WebP and AVIF on your pages:

  • Serve them with picture tags, the default, wraps the images in your posts and those your theme shows through WordPress. Each page is the same for every visitor, so page caches and CDNs keep working, and a browser that reads neither format gets the original.
  • Serve them on the whole page also reaches the images WordPress doesn't print itself: raw HTML, a page builder's or a theme's own markup, and the images in the folders you chose. The plugin reads each page as WordPress sends it, which takes a little longer on a page your cache hasn't kept. An image already in a picture tag, yours or the plugin's, is left as it is. On a network, only the main site's pages serve the copies of the folders' images, since it chooses the folders.
  • Serve them through server rules leaves your pages as they are: your server sends the WebP or AVIF copy beside an image in its place to each browser whose Accept header names that format, with Vary: Accept. It reaches every image in the uploads folder and the folders you chose, backgrounds in stylesheet files included, and nothing outside them.
  • Don't change the pages makes the copies without any page naming them.

Serve them on the whole page also reaches the background images a page sets itself, in a style attribute or a <style> element, such as a page builder's hero. A background or background-image declaration that names an optimized image by its address, rather than through a CSS variable, keeps its original and gets a copy of itself right after it, where that address becomes an image-set() of the AVIF and WebP copies. The browser picks the first format it reads, and a browser that can't read image-set() keeps the original. A background set in a stylesheet file keeps its original, since that file is never part of the page.

A copy is named only while the plugin can prove it's its own: it made the copy, and neither the copy nor the image beside it changed since.

Add the width, height and alt text images lack, a setting of its own on the same page, is off until you turn it on there or from a page audit. With it on, each page WordPress sends gives an image from your media library what its markup leaves out: its width and height, read from the image's metadata by WordPress's own wp_img_tag_add_width_and_height_attr() when the tag gives neither, or the one it lacks in the image's proportions when it gives the other; and the alt text it has in your library when the tag has no alt at all and its address is one of that image's files. An alt="" someone set on purpose stays empty, and nothing already on a tag changes. Images your theme prints from its own folder aren't in the library, so they're left as they are, and so is an image inside a picture tag your theme wrote, or one WP Offload Media serves from its bucket without the class WordPress gives it in a post. Turning the setting on or off empties the page caches the plugin knows.

With Serve them through server rules, on Apache and LiteSpeed the plugin writes its rules into your site's .htaccess when that file already turns rewriting on: at its end, after the rules already there, or on a network above WordPress's own. Anywhere else the settings show the lines to paste, and on Nginx the lines for your site's server block. Each time you save, the plugin asks your site for a test image of its own, once accepting AVIF and once not, and the settings say whether the server sent the copy. A server that answers with an error once the rules are in gets them taken out again. On a network, each site's rules cover its own uploads folder.

A CDN in front of your site has to keep a version of each image per format. Cloudflare keeps one, whatever the browser reads, so the settings warn when Cloudflare answers, and picture tags are the choice there. An image WP Offload Media serves from its bucket never reaches the rules.

The rules can only see that a copy is there, not who made it. So while they're on, the plugin takes its copy off the server as soon as it sees the image beside it change (an edit, a file replaced in place, a theme's image a scan finds changed), and once over the whole library when you turn them on. A WebP or AVIF file another tool left beside an image is served too. Turning the plugin off takes the rules out, and turning it on puts them back.

Other plugins, large files and passwords

  • Translations. WPML and Polylang translate an image by adding attachments that share its files. The plugin optimizes those files once, through the first of them, and never sends a translation on its own, so nothing is compressed twice and no translation's deletion takes the backup with it. Deleting the image they translate hands its record to the next translation. A translation's page shows the WebP and AVIF copies of the image it translates.
  • Regenerate Thumbnails and wp media regenerate. Regenerated sizes are made from the main file, which is the plugin's own output once an image is optimized. The image then goes again from its backup, and those sizes are replaced with files made from the original.
  • Enable Media Replace. A replaced file is a new original: it goes to Iminify as one, and the old backup is kept aside rather than put back.
  • WooCommerce. Product galleries keep their zoom, lightbox and variation images with the picture tags: choosing a variation shows its own image, and Reset shows the product's again.
  • WP Offload Media. The WebP and AVIF copies go up to the bucket with each image, and the picture tags serve them from there. A copy is served from the bucket only once it went up, so an image optimized while WP Offload Media was off keeps its original until it's optimized again. With its "Remove Local Media" setting on, the plugin copies back to the server only the file it needs (the image's original, or the file WordPress makes a new size from) for as long as that takes, and the image's files leave the server again once they go up. The backups stay on the server, under uploads/iminify-backup. Copies left from before a restore, or after you delete the plugin, stay in the bucket until their image is deleted, but no page shows them.
  • Page caches. When a bulk run ends, when a restore run is paused or stopped, when you restore an image or delete its copies, when an update replaces a theme or plugin that holds a folder you chose, when you change how the copies are served, and when you delete another image optimizer whose copies your pages served, the plugin empties the caches of LiteSpeed Cache, WP Rocket, W3 Total Cache and Cloudflare's plugin, so no cached page points at a copy that has gone. Cloudflare's plugin empties its cache only with its automatic cache management or APO on. An upload empties nothing: a cached page still shows its old file until the cache refreshes it.
  • Large originals. Where WordPress sends over cURL, the plugin hands cURL the original to read from the disk, so a file as large as your plan takes goes through on a 128 MB memory limit. Elsewhere an original too large for the server's memory goes as WordPress's -scaled copy.
  • A site behind a password. The background runs reach the site with the password the page was opened with. If they still can't, add the user name and password to wp-config.php:
PHP
define( 'IMINIFY_AUTH_USER', 'user' );
define( 'IMINIFY_AUTH_PASSWORD', 'password' );

Switching from another optimizer

The plugin reads what ten other image optimizers leave on a site: Imagify, EWWW Image Optimizer, ShortPixel, Smush, TinyPNG, Image Optimizer by Elementor, Converter for Media, Optimole, Modern Image Formats and LiteSpeed Cache. Their optimized images, originals, WebP and AVIF copies and settings carry over, and nothing of theirs is moved or deleted unless you ask.

Install Iminify before you remove the old plugin, so its settings can still be read. Imagify, Converter for Media, LiteSpeed Cache and Modern Image Formats delete their settings when they're deleted. The plugin keeps a copy of them on your site each time you open its settings page and right before that plugin is turned off or deleted, and sends it nowhere until you ask.

  • Its settings. Right after you connect, and on Settings, Iminify after that, the plugin offers to use that plugin's settings, as in Use Imagify's settings. It sends that plugin's image settings, never its API key, and the names of your image sizes to POST /site/import, then shows what would change beside your site's settings now: the compression level, the maximum width, metadata, WebP and AVIF copies, the sizes and backups. Use these settings saves them, and No thanks puts the offer away. Backups are turned on when that plugin kept them, and never turned off.
  • While it still optimizes uploads. An optimizer that's active with its own upload optimization on would compress an image a second time, so Iminify sends nothing while it's on: uploads, presses and bulk runs wait, and the plugin's pages name it and the setting to switch off. Restoring and serving copies go on.
  • The images it optimized. They read Optimized by that plugin in the media library, with the saving it recorded and whether it kept the original, and the library's Optimized by another plugin filter and the bulk page count them apart. Iminify never sends one by itself, and never one whose original is gone.
  • Restoring them. Restore puts back the original that plugin kept. Where that plugin recorded each file's size before its first pass, its backup is used only when the sizes match, so a backup it compressed is never taken for the original. Each size that plugin kept goes back too, and WordPress makes the rest again. That plugin's backup stays where it was. An image whose original is in EWWW's cloud is restored in EWWW, and one Optimole moved off your server is rolled back in Optimole first.
  • Optimizing them again. Optimize them again from their originals on the bulk page, Optimize again from the original in the media library and wp iminify optimize --others put each original back first, then send the image, which counts as one of your daily images. Iminify keeps that original in its own backup even with backups off, so you can still restore the image once the other plugin is gone.
  • Its WebP and AVIF copies. A copy that plugin's records name, no older than its image, keeps being served by the picture tags until Iminify makes its own. Iminify never deletes one: restoring the image or deleting Iminify only stops serving it. Converter for Media's copies are served from its own folder, wp-content/uploads-webpc, and LiteSpeed Cache's are never taken over, since nothing it records names them. With Serve them through server rules, any copy beside an image is served, whoever made it.
  • Images converted to WebP or AVIF. Image Optimizer by Elementor can turn photo.jpg into photo.webp, and Modern Image Formats can replace an image's files with AVIF ones. Optimizing such an image again starts from the JPEG that plugin kept and makes the files in their new format under their new names, so your posts still link to them, and Iminify keeps that JPEG in its own backup whatever your backups setting. Putting the JPEG back would change the image's address, so restoring stays that plugin's to do (Image Optimizer by Elementor's own Restore), and Restore all leaves these images as they are. Once Image Optimizer by Elementor's bulk Reoptimize has run on a converted image, its records no longer name the JPEG's bytes, and Iminify reads that image as having no original.
  • The rules it left behind. EWWW, ShortPixel, TinyPNG, Imagify and Converter for Media can leave rules in your site's .htaccess files (Imagify also in conf/imagify.conf, for Nginx), and Smush a PNG rule among WordPress's rewrite rules, which keep sending browsers that plugin's old copies in place of your images. Once that plugin is off, Settings, Iminify lists each one with what it does, and takes it out only when you press Remove. Where WordPress can't write the file, the page shows the lines to remove by hand. On a network, the rules in files every site reads are listed on the network admin's page once no site uses that plugin.
  • LiteSpeed Cache. Most sites keep it for its cache. While it's active, each time WordPress makes an image's sizes again (Regenerate Thumbnails, or a replaced image), it deletes the WebP and AVIF copies beside the image and puts back the old files it kept of an image it optimized, so Iminify reads that image as changed. Remove Original Image Backups, under LiteSpeed Cache, Image Optimization, stops that.

WP-CLI

wp iminify runs the same bulk run as Media, Bulk Optimization, for large libraries and hosts whose scheduled tasks don't run. A run started in the shell shows on that page, and one started there can be carried on in the shell.

Command What it does
wp iminify optimize --all Sends every image not optimized yet. wp iminify optimize 12 34 sends those attachments, and --failed sends the failed images again. An image already optimized is left out, even when you name it.
wp iminify restore --all Puts every optimized image back from its backup, after asking (--yes skips the question). It takes attachment ids too, and works on any plan and with the site disconnected. An image another plugin converted to WebP or AVIF stays as it is, since only that plugin can put its original back.
wp iminify missing formats Sends the images that lack a format. It takes attachment ids too.
wp iminify missing sizes Makes and sends the sizes images lack. It takes attachment ids too.
wp iminify alt-text --all Writes AI alt text for every image with none, one of your AI alt texts for the day each, from a small copy of each; an alt text anyone wrote is never replaced. It takes attachment ids too, and needs Write alt text with AI on.
wp iminify run Carries on the run that's going, whatever started it: one whose scheduled tasks don't run, or one left behind when a command was cut short.
wp iminify stop Ends the run. Images already with Iminify finish, and the rest stay as they were.
wp iminify status Prints the library's counts and the run. --estimate asks Iminify how long the images left take on your plan, and --format=json prints it for a script.
wp iminify folders add themes/your-theme Adds a folder in wp-content and looks through it. folders scan looks through every folder again, folders remove takes one off the list, and folders alone lists them.
wp iminify optimize --folders Sends the images in your folders not optimized yet, or with --failed the ones that failed. wp iminify restore --folders puts them back.
wp iminify optimize --others Optimizes again the images another image optimizer compressed, from the originals it kept: each original goes back first, then the image is sent and counts as one of your daily images. An image that plugin converted to WebP or AVIF keeps its format and file names: Iminify makes its files again in that format from the original. It takes attachment ids too. An image whose original is gone is left as it is.

optimize, restore and missing stay with the run and show a progress bar. Pass --background to start it and return. When today's images run out, the command hands the run to the site's scheduled tasks, says when the next batch opens, and ends.

The commands need no WordPress user. If you name one with --user, that account needs the capability the bulk page asks for, or for folders and --folders the one Other Folders asks for.

Who can do what

Part Capability
The settings page manage_options
The network's connection manage_network_options, under Network Admin, Settings, Iminify
The bulk page manage_options, since a run spends your account's images for the whole library
Other folders manage_options, or manage_network_options on a network
The page audit manage_options, since each audit spends one of your page scans
Optimizing or restoring one image upload_files, and edit_post on that image, so an author gets their own images and an editor everyone's

Hooks

Hook Type What it's for
iminify_capability Filter: $capability, $context The capability a part asks for. $context is settings, bulk, media, folders, audit or network.
iminify_optimize_image Filter: $optimize, $attachment Return false to keep an image from being sent, on upload, in bulk or at someone's press. A bulk run marks it as skipped.
iminify_optimize_file Filter: $optimize, $path The same for a file in another folder, by its path in wp-content.
iminify_disk_free_space Filter: $free The free bytes the plugin reads for the uploads folder, or null when the host doesn't say, for a host whose real limit is a quota the disk doesn't show. The plugin keeps a reserve of it free, opening no group and writing nothing below it.
iminify_purge_caches Filter: $purge, $why Return false to keep the page caches as they are. $why is bulk after a bulk run, restore after images were restored or their copies deleted outside one, uninstall after deleting the plugin removed its copies, delivery after the way the copies are served changed or Add the width, height and alt text images lack was turned on or off, or others after deleting another image optimizer whose WebP and AVIF copies the pages served.
iminify_page_buffer Filter: $read Return false to leave a page as WordPress printed it when Serve them on the whole page, or Add the width, height and alt text images lack, is on in the plugin's settings. It runs on template_redirect, so conditional tags work.
iminify_stream_source Filter: $streams, $path Return false to read an original into memory rather than stream it over cURL, for a host whose proxy breaks a streamed upload. An original too large for the server's memory then goes as WordPress's -scaled copy.
iminify_image_optimized Action: $attachment, $result An image's files were written. $result holds level, formats, and each size's before and after bytes in outputs.
iminify_alt_text_written Action: $attachment, $text An image's AI alt text was written, in a field that had none.
iminify_image_restored Action: $attachment An image's original is back, its sizes made again and its copies gone.
iminify_file_optimized Action: $path, $result A file in another folder was written. $result is as for an image.
iminify_file_restored Action: $path A file in another folder has its original back, and its copies are gone.
iminify_copies_deleted Action: $attachment An image's WebP and AVIF copies were deleted from its panel, or by a restore WordPress couldn't finish, which leaves the image as it was.
iminify_bulk_finished Action: $run A bulk run went through every image and nothing it sent is still on its way. $run holds action (optimize, retry, restore, formats, sizes, redo or alt_text), scope (library or folders), total, sent, failed and passed.
iminify_bulk_paused Action: $run A bulk run was paused, by its button or because the disk is full or the plugin was turned off. Nothing more is sent until it goes on. $run is as for iminify_bulk_finished.
iminify_bulk_stopped Action: $run A bulk run was stopped before its end. What it did stays done, and what it queued without a group open goes back to not optimized, or, in a redo run, back to the plugin that optimized it. $run is as for iminify_bulk_finished.
PHP
add_filter( 'iminify_optimize_image', function ( $optimize, $attachment ) {
    return get_post_meta( $attachment, 'keep_as_uploaded', true ) ? false : $optimize;
}, 10, 2 );