WordPress creates smaller versions of uploaded images for the sizes used by your theme. Regenerating these thumbnails can create the required sizes after a theme or image-setting change.

Prepare the site

Back up the database and uploads, confirm that WP-CLI is installed, and connect through SSH as the site’s owning user. Check available disk space and run large jobs during a quieter period.

Change to the actual WordPress installation directory:

cd /path/to/wordpress

Regenerate thumbnails

To process the media library while retaining existing thumbnail files:

wp media regenerate --skip-delete

Review the confirmation before continuing. To process selected attachments, replace these example IDs with the required media IDs:

wp media regenerate 123 124 --skip-delete

To create missing sizes only:

wp media regenerate --only-missing --skip-delete

This does not recreate an existing size whose dimensions have changed. The --yes option skips the confirmation prompt; use it only after checking the scope.

Verify the images

Review the command’s result and check thumbnails on representative pages. Clear relevant image or page caches if they continue showing older versions.