Over time, when you change your theme or modify image settings, you may need to regenerate thumbnails for your WordPress site. WP-CLI makes this process quick and easy.
Prerequisites:
- SSH access to your server.
- WP-CLI installed.
Follow steps:
- Connect to Your Server via SSH.
- Open your terminal and connect to the server:
ssh username@your-server-ip
- Navigate to the WordPress installation directory:
cd /path/to/wordpress
- Run the Regenerate Thumbnails Command using the below command to regenerate all thumbnails:
wp media regenerate
This command will process all images in the media library. It will regenerate thumbnails based on the sizes defined in your settings.
- Additional Options
- To regenerate only missing thumbnails:
wp media regenerate –only-missing - Skip confirmation prompts by using:
wp media regenerate –yes - To regenerate thumbnails for specific image :
wp media regenerate <image_id>
- To regenerate only missing thumbnails:
- After the process is complete, visit your site to check if the images have been properly regenerated.
This way, you can regenerate WordPress image thumbnails using WP-CLI.
For more help, contact our support staff.