Skip to content

How to regenerate image thumbnails in WordPress

Best option: WP-CLI

If you have WP-CLI installed on your server, you can regenerate all images by running this command:

$ wp media regenerate

The output should be something like:

Do you really want to regenerate all images? [y/n] y
Found 165 images to regenerate.
1/165 Regenerated thumbnails for "passgen@2x-1" (ID 1921).
2/165 Regenerated thumbnails for "passgen@2x" (ID 1920).
3/165 Regenerated thumbnails for "safehouse@2x" (ID 1917).
4/165 Regenerated thumbnails for "safehouse-app" (ID 1916).
5/165 Regenerated thumbnails for "mus-app@2x" (ID 1912).
6/165 Regenerated thumbnails for "mus-app-3" (ID 1911).
7/165 Regenerated thumbnails for "mus-app-2" (ID 1910).
8/165 Regenerated thumbnails for "mus@2x" (ID 1909).
9/165 Regenerated thumbnails for "gsm-hand-1@2x" (ID 1904).
[...]

Optionally, the regenerate function can take a few parameters:

  • $ wp media regenerate 123 124 125 will regenerate media only for those IDs.
  • $ wp media regenerate --image_size=large will regenerate only the thumbnails of “large”.

Documentation