smallapis

WP-CLI

Everything the WebP & AVIF Offload dashboard does is also a command, the comfortable way past ten thousand images. Available from version 1.5.0.

Status

wp webp-avif status

What is converted, pending and excluded, and what the server can do.

Dry run

wp webp-avif scan

Reads the library and writes nothing: how many files would be converted, the expected saving, and what is left out and why.

Convert

wp webp-avif convert
wp webp-avif convert 120 121 122
wp webp-avif convert --format=webp --limit=500

Converts the whole library, or the attachment IDs given. --format takes webp, avif or both; --limit caps the number of images handled in one run, useful to spread a large library over several runs.

Delivery check

wp webp-avif check

The same check as the Check my site button: it downloads a converted file from the site and verifies the status, the bytes and the content type.

Remove every copy

wp webp-avif remove --yes

Deletes every WebP and AVIF copy and resets the figures. Originals are never touched.

Running it on a schedule

New uploads are converted automatically, so a schedule is rarely needed. To work through a very large existing library at night, a cron line such as this one is enough:

0 3 * * * cd /path/to/wordpress && wp webp-avif convert --limit=2000 --quiet