WordPress
How To Regenerate Thumbnails In WordPress

How To Regenerate Thumbnails In WordPress

Thumbnails are resized versions of images that WordPress creates automatically during uploads. They act as previews for larger images and are commonly used in posts, galleries and featured sections. Default sizes include Thumbnail, Medium, Large and Full, making it easier to display visuals across various layouts without compromising site speed.

How WordPress Handles Thumbnails

WordPress automatically resizes images upon upload based on your theme’s specifications and Media settings. Each theme may define unique image sizes. For example, blog themes might prioritise portrait thumbnails while eCommerce themes may use square or landscape dimensions. You can customise these settings under Settings > Media to better fit your needs.

The Impact of Themes on Thumbnail Sizes

Changing themes can cause thumbnails to mismatch new specifications. A new theme may define different sizes from your previous theme, requiring old thumbnails to be updated. For instance, switching from a blog to an eCommerce theme might awkwardly stretch or crop product images. Regenerating thumbnails ensures all images match the updated size requirements, maintaining a cohesive appearance.

Why Regenerate Thumbnails?

Regenerating thumbnails keeps your WordPress site visually consistent and professional. When you change themes or settings, old thumbnails often do not fit the new dimensions, potentially distorting images or making your site look unpolished. By regenerating thumbnails, you align all images to the latest requirements, improving user experience, boosting click-through rates and helping free up server space.

Key Benefits

Aligning Older Images with New Theme Requirements

New themes often introduce different image sizes, so old thumbnails will not match these settings. Regeneration updates all thumbnails to fit the new theme perfectly.

Fixing Distorted or Stretched Images

Outdated image dimensions can make thumbnails appear stretched or cropped. Regenerating fixes these issues, making images sharp and proportional.

Improving User Experience and CTR

Attractive, well-sized thumbnails grab attention and encourage clicks, especially for featured posts or WooCommerce products.

Freeing Up Server Space

Over time, unused image sizes accumulate. Regenerating lets you delete these files, freeing valuable server space and improving performance.

Common Use Cases

Post-Theme Switch Updates

A new theme often requires resizing older images. Regeneration ensures thumbnails match updated settings.

Fixing Broken or Outdated Thumbnails After Site Import

Migrating a site can disrupt image sizes. Regenerating resolves broken or missing thumbnails, ensuring everything displays properly.

Optimising WooCommerce or Plugin Images

Plugins like WooCommerce require specific image sizes for products. Regenerating thumbnails ensures seamless integration and better presentation.

Methods to Regenerate Thumbnails

Using Plugins

Regenerate Thumbnails Plugin

The Regenerate Thumbnails plugin (by Alex Mills) is widely used, with over 1 million installs, and works seamlessly for beginners.

Installation steps:

  1. Go to Plugins > Add New in your WordPress dashboard
  2. Search for Regenerate Thumbnails by Alex Mills
  3. Click Install Now and then Activate

Regenerate all thumbnails: navigate to Tools > Regenerate Thumbnails and click the Regenerate All Thumbnails button. The plugin resizes all images based on current settings.

Regenerate specific thumbnails: go to Media > Library, switch to list view, hover over an image and click Regenerate Thumbnails.

Customisation options:

  • Skip correctly-sized thumbnails: saves time by skipping images already matching desired dimensions
  • Delete old image sizes: frees server space by removing unused thumbnails

Force Regenerate Thumbnails Plugin

This plugin deletes outdated image sizes before creating new ones, useful for a clean slate but requiring caution.

Steps to use:

  1. Install and activate the plugin
  2. Go to Tools > Force Regenerate Thumbnails
  3. Click Regenerate All Thumbnails

Unlike the Regenerate Thumbnails plugin, this removes old image sizes entirely. It is ideal for resolving conflicts or server space issues. The plugin has not been updated frequently, so test it on a staging site before use.

Using WP-CLI (Command Line Interface)

WP-CLI is a powerful tool for advanced users that regenerates thumbnails faster and avoids HTTP request limitations.

Requirements: server access and basic knowledge of command-line tools.

Commands for thumbnail regeneration: the basic command is wp media regenerate, which regenerates thumbnails for all images. To regenerate specific images, use wp media regenerate 123 456, and to skip confirmation add the --yes flag.

When to use WP-CLI: best for large sites with thousands of images. It avoids plugin-related overhead and HTTP timeouts, and works well for bulk regeneration or updating specific images without affecting others.

Manual Methods (Custom Code)

Adding a Custom Function

For lightweight sites, you can add a custom function to your theme’s functions.php file that loops through every attachment, fetches the attached file with get_attached_file, and rebuilds the metadata using wp_generate_attachment_metadata and wp_update_attachment_metadata.

Running the function: create a custom admin page to trigger the function, or run it directly from your code editor.

When manual methods are useful: ideal for developers maintaining plugin-free sites. It provides full control over the process.

Best practices: back up your site before making changes, and test the function in a staging environment to avoid errors.

Comparison Table of Methods to Regenerate Thumbnails

MethodDescriptionBest ForKey Tools
Regenerate Thumbnails PluginEasy-to-use plugin to resize all or specific thumbnails to match current settingsBeginners and quick updatesRegenerate Thumbnails plugin
Force Regenerate Thumbnails PluginDeletes old image sizes before regenerating new ones for a clean resetCleaning up outdated image sizesForce Regenerate Thumbnails plugin
WP-CLI (Command Line)Advanced tool for regenerating thumbnails directly via server commandsLarge media libraries and advanced usersWP-CLI
Custom CodeLightweight, code-based method using PHP functions for regenerationDevelopers and plugin-free setupsCustom function in functions.php

Managed Hosting solutions for WordPress backed by Speed, Security and Scalability

Talk To Sales →

Advanced Considerations

Best Practices for Regenerating Thumbnails

Backup recommendations before regenerating: always back up your site before starting. Use tools like UpdraftPlus to save your database and media files, preventing data loss if something goes wrong.

Testing on staging environments: test changes on a staging site before applying them live, ensuring thumbnails regenerate correctly without disrupting your main site.

Handling large media libraries efficiently: for websites with thousands of images, regenerate in batches to avoid server overload. Use WP-CLI for faster processing and less resource strain.

Troubleshooting Common Issues

Distorted or missing thumbnails after regeneration: check your theme’s image dimensions in Media settings. If sizes do not match, regenerate thumbnails again using updated settings.

File permission errors in the uploads folder: ensure your wp-content/uploads folder has permissions of 755 or 775. Incorrect permissions can block thumbnail creation.

Ensuring the PHP GD library is installed and enabled: the PHP GD library processes images in WordPress. Contact your host to verify it is active on your server if thumbnails fail.

Addressing server performance bottlenecks: large sites can face slowdowns during regeneration. Increase PHP memory limits or switch to a high-performance hosting plan to avoid downtime.

Optimising Thumbnail Regeneration

Compressing regenerated images: after regeneration, use tools like Optimole or ShortPixel to compress images, reducing file size without sacrificing quality.

Using lazy loading to enhance page speed: enable lazy loading for thumbnails, ensuring images load only when needed and reducing initial page load time.

Combining thumbnail regeneration with other tasks: take the opportunity to clean up your media library by deleting unused images, updating alt texts and organising files.

Tools and Plugins for Thumbnail Management

Regenerate Thumbnails

This plugin is a go-to for resizing thumbnails, working quickly and remaining user-friendly. It regenerates all or specific thumbnails based on current theme settings and offers options to skip correctly sized images or delete unused sizes. It is ideal after a theme switch or media setting update.

Force Regenerate Thumbnails

This plugin deletes old image sizes before regenerating new ones, ensuring a fresh start. Use it when server space is limited or if outdated sizes create clutter, and to fix persistent image display issues. Test it on a staging site before using it on live websites to avoid data loss.

Optimole and Other Compression Tools

Compression tools like Optimole and ShortPixel enhance thumbnail quality and reduce file size. Compressed images load faster without losing clarity and support automatic resizing for responsive design, which is perfect for optimising regenerated thumbnails on media-heavy sites.

Alternative Plugins for Image Management

Media Cleaner: removes unused or broken media files from your library, ideal for decluttering after thumbnail regeneration. EWWW Image Optimizer: optimises images for faster loading and automatically compresses images as you upload them.

Comparison Table of Thumbnail Management Tools

Tool/PluginDescriptionBest Use CaseKey Features
Regenerate ThumbnailsResize all or specific thumbnails to fit current settingsAfter theme changes or Media setting updatesSkips correctly sized images and deletes unused sizes
Force Regenerate ThumbnailsDeletes old image sizes before regenerating new onesCleaning up server space or fixing clutterRemoves outdated sizes and regenerates fresh thumbnails
OptimoleCompresses and optimises images for faster loadingImproving page speed after regenerationAutomatic compression, responsive resizing
ShortPixelEnhances image quality while reducing file sizeOptimising regenerated thumbnailsSupports various compression levels
Media CleanerRemoves unused or broken media filesCleaning up the library after regenerationDetects unused images and organises media files
EWWW Image OptimizerCompresses and optimises images during uploadsMaintaining optimised media librariesAutomatic optimisation, bulk optimisation

Conclusion

Regenerating thumbnails keeps your WordPress site visually consistent and professional. It fixes distorted or outdated images, aligns thumbnails with new themes and improves user experience. Whether you use plugins, WP-CLI or custom code, choose a method matching your skills and website needs.

Before starting, back up your site and test on a staging environment. Use tools like Optimole or ShortPixel to compress images and boost page speed, and regularly clean up unused media files to maintain an optimised library. A well-managed thumbnail system ensures your site runs smoothly, looks great and delivers the best visitor experience.

FAQs

How do you refresh thumbnails in WordPress?

You can refresh thumbnails by regenerating them using the Regenerate Thumbnails plugin. Go to Tools > Regenerate Thumbnails and click Regenerate All Thumbnails. This updates every thumbnail to match your latest configuration.

Why are my thumbnails not working in WordPress?

Thumbnails may fail due to incorrect image sizes, file permissions or missing server tools. Check the Media settings for proper dimensions and ensure the uploads folder has correct permissions (755 or 775). Also confirm the PHP GD library is active, as it handles image processing.

How do I rebuild media in WordPress?

To rebuild media, regenerate all thumbnails using a plugin like Regenerate Thumbnails. Alternatively, use WP-CLI for faster processing with the command wp media regenerate. For broken images, verify file paths and fix any upload issues.

How do you regenerate image size in WordPress?

Install the Regenerate Thumbnails plugin. After activation, go to Tools > Regenerate Thumbnails and click Regenerate All Thumbnails to resize every image in your media library, updating dimensions to match new theme or Media setting requirements.

How do you regenerate WordPress thumbnails?

You can regenerate thumbnails using plugins like Regenerate Thumbnails or Force Regenerate Thumbnails. For advanced users, WP-CLI is faster: run the command wp media regenerate to update all thumbnails. Always back up your site before starting.

Hosting That Keeps Up With Your Content

Every FastCow plan includes free SSL, a global CDN, daily backups and 24/7 expert support, set up for you.

View Packages
← Back to all articles