2026年11月12日
2026年11月12日
How to Compress Images with Smush: Bulk Optimize, Lazy Load, WP-CLI
This article is a localized edition of the Japanese original. Read the Japanese original
Smush is a plugin that compresses images uploaded to WordPress to reduce their file size. It is developed by WPMU DEV. Automatic compression on upload, bulk optimization of Media Library images and image lazy loading (Lazy Load) are available in the free version.
The details in this article were checked against the files of Smush 4.3.6 as distributed on WordPress.org as of November 2026. This version requires WordPress 6.4 or later and PHP 7.4 or later. The admin screens have a new design, and as of November 2026 the Japanese translation does not yet cover all of it, so screen names are given as they appear in the English UI.
Free version vs Smush Pro
| Feature | Free version | Smush Pro |
|---|---|---|
| Automatic compression on upload, bulk optimization | Yes | Yes |
| Maximum image size that can be compressed | 5MB per image (larger images are skipped) | Up to 256MB |
| Compression level | Basic 1X. Super 2X is available after connecting a free WPMU DEV account | Up to Ultra 5X |
| Compressing the original (full-size) image | No. It compresses the resized versions WordPress generates | Yes |
| Lazy loading (Lazy Load) | Yes | Yes |
| WebP and AVIF conversion and delivery, CDN, image preloading | Pro only | Yes |
In the free version, the resized versions WordPress generates on upload, such as thumbnails, are what gets compressed. Note that the original image itself does not get smaller.
1. Install and activate
In the admin, go to "Plugins → Add New", search for "Smush", install it and activate it. With WP-CLI:
wp plugin install wp-smushit --activate
Once activated, a "Smush" menu is added to the admin, with "Dashboard", "Lazy Load & Preload", "CDN", "Directory Optimization" and "Settings" under it. A setup guide (wizard) appears the first time.
2. Check the default settings
Smush's defaults are as follows. Many sites can start with them as they are.
| Setting | Default | What it does |
|---|---|---|
| Automatic Compression | On | Automatically compresses newly uploaded images |
| Compression Level | Basic 1X | Compression without quality loss (lossless) |
| Metadata removal | On | Removes data embedded in images, such as the shooting date and location (EXIF) |
| Backup original images | On | Keeps the image from before compression so you can restore it later |
| Lazy Load | Off | You turn lazy loading on yourself |
Turning "Backup original images" off saves disk space, but you can no longer restore compressed images. Leave it on when you first start using the plugin.
3. Optimize existing images in bulk
Images uploaded before you installed Smush are not compressed automatically. "Smush → Dashboard" shows the number of images that need optimizing (Images to optimize); start bulk optimization with "Optimize Images".
- Processing runs in the background, so it continues even if you close the screen. You can also get a notification email when it finishes.
- In the free version, images larger than 5MB are skipped.
Back up the whole site (files and database) before bulk optimization for peace of mind.
4. Optimize with WP-CLI
Smush has WP-CLI commands. On sites with many images, running them on the server is less likely to stop halfway than using the admin screen.
# List images that have not been optimized yet
wp smush list
# Show only the first 100
wp smush list 100
# Optimize all images
wp smush compress
# Optimize only the image with attachment ID 10
wp smush compress --type=single --image=10
# Specify several IDs
wp smush compress --type=multiple --image=10,15,16
# Rescan the Media Library
wp smush scan
# Restore from backup (omit --id to restore all)
wp smush restore --id=10
5. Set up lazy loading (Lazy Load)
Lazy loading delays loading an image until just before it appears on screen. Turn Lazy Load on under "Smush → Lazy Load & Preload".
The main settings are:
- Media types to lazy load: the image formats to target (JPEG, PNG, WebP, GIF, SVG) and iframes. You can also choose YouTube and Vimeo video embeds (off by default).
- Post types to lazy load: the kinds of pages to target (front page, posts, pages, archives and so on).
- Native Lazy Loading: a setting to use the browser's built-in lazy loading (
loading="lazy"). - Exclude content from Lazy Load: specify URLs and keywords (image classes or IDs) that should not be lazy loaded.
Exclude above-the-fold images
If you lazy load a large image that is visible as soon as the page opens (a hero image, a logo and so on), it appears later and the Core Web Vitals LCP (the time until the largest content is shown) gets worse. Exclude such images.
There are three ways to exclude them.
- Enter the image's class name or ID in "Exclude keywords" under "Exclude content from Lazy Load"
- Add the class
no-lazyloadorskip-lazyto the image (Smush does not lazy load images with these classes) - Exclude them in code (example below)
<?php
// Exclude images whose URL contains hero or logo from Smush lazy loading
add_filter( 'smush_skip_image_from_lazy_load', function ( $skip, $src, $image ) {
if ( false !== strpos( $src, 'hero' ) || false !== strpos( $src, 'logo' ) ) {
return true;
}
return $skip;
}, 10, 3 );
Add this code to your child theme's functions.php or to a plugin such as Code Snippets.
How it relates to WordPress’s own lazy loading
WordPress itself also adds loading="lazy" to images in posts automatically. The Smush screen also advises using only one lazy loading feature at a time. If lazy loading is also enabled in your theme or another plugin (such as a caching plugin), keep only one.
6. If you want WebP or AVIF
Converting to and serving WebP and AVIF with Smush (Next-Gen Formats) is a Pro feature. To use WebP or AVIF for free, consider other options such as the "Modern Image Formats" plugin from the WordPress Performance Team. For how another image optimization plugin compares, "How to use EWWW Image Optimizer" may also help.
Use only one image optimization plugin. Using several at once can compress the same image twice or make lazy loading conflict.
7. Check the results
- "Smush → Dashboard" shows how many images were optimized and how much size was saved.
- The Media Library list (list view) also shows the optimization status of each image.
- Compare page speed before and after optimization with Google PageSpeed Insights. Factors other than images (server response time, JavaScript and so on) also matter, so check whether the image-related findings went down.
If you use a page cache, clear it after optimizing before you check.
8. Restore images
If you are unhappy with the quality of a compressed image, you can restore it as long as "Backup original images" was on. Restore it by opening the image in the Media Library, or use wp smush restore in WP-CLI. "Smush → Settings" also has an option to restore all images to their original state.
Notes
- Setting the compression level to Super or Ultra (lossy compression) lowers image quality slightly. On photo-heavy sites, zoom in on a few images after changing it to check.
- If you shrink very large images to the size actually needed for display before uploading, they are also less likely to hit the free version's 5MB limit.
- "Directory Optimization" compresses images outside the Media Library (such as in theme or plugin folders). Updating a theme puts the original files back, so run it again after updates.
Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)