Daniyal Dev — Dev Project

If slow images are dragging your WordPress site down, this plugin fixes it the right way. No jumping between apps, no downloading files, no confusing settings buried somewhere else. The Squoosh WordPress Plugin brings a full image editor into your Media Library and lets you compress, convert, and optimize everything right where you work.

It uses Google’s Squoosh compression engine under the hood, the same tool developers and designers use to squeeze images down to their smallest possible size without losing quality. Now it works inside WordPress, with no extra software needed.


01Image Size Is Quietly Hurting Your Site

Images are usually the heaviest part of any web page. When they’re unoptimized, they make your pages load slowly. Slow pages push visitors away, and search engines notice that too.

Google’s Core Web Vitals include page load speed as a direct ranking factor. Images are one of the biggest contributors to that score, which means optimizing them isn’t just about user experience. It matters for SEO too.

Here’s what unoptimized images cost you:

  • Pages that take too long to load, especially on mobile connections
  • Higher bounce rates because visitors don’t wait
  • Lower search rankings due to poor performance scores
  • More server bandwidth used than necessary

Switching even a portion of your media library to WebP or AVIF can cut image file sizes by 30 to 80 percent, with no visible quality difference to your readers. The Squoosh WordPress Plugin makes this conversion straightforward, even if you’ve never touched image compression before.


02What the Squoosh WordPress Plugin Actually Does

In plain terms: this plugin puts a full-screen image editor inside your WordPress admin. When you want to compress or convert an image, you open it in the editor, adjust the settings, preview the result, and save. Done.

Before saving anything, the plugin creates a backup of your original. If you change your mind later, you can restore it. Nothing is permanently lost unless you specifically tell it to delete the backup.

💡 The compression processing happens locally in your browser using WebAssembly. Your images are never sent to a third-party server. Everything runs on your machine, directly inside WordPress.


03What’s Included in This Plugin

Here’s a quick look at everything packed into the Squoosh WordPress Plugin:

🖼️
Built-in Image Editor

Full Squoosh editor embedded in your Media Library. No redirects, no extra tabs.


Live Before/After Preview

See the original and compressed version side by side before you commit to saving.

🔄
Bulk Conversion

Select multiple images and convert them all at once. Runs in the background using a queue system.

🛡️
Automatic Backups

Every edit creates a backup first. Restore your original with one click if you need to.

📁
6 Format Options

Convert between JPEG, PNG, WebP, AVIF, JXL, and QOI depending on your use case.

📶
Offline Support

A service worker caches the editor assets locally. If your internet drops, you can still keep working.


04Supported Image Formats

JPEG
PNG
WebP
AVIF
JXL
QOI
  • JPEG: The classic choice for photos. Broad compatibility everywhere.
  • PNG: For logos, icons, and anything needing a transparent background.
  • WebP: Google’s modern format. Same quality as JPEG at roughly half the size. Supported by all current browsers.
  • AVIF: Even better compression than WebP. Best results for photos with fine detail.
  • JXL (JPEG XL): Next-generation format supporting both lossless and lossy compression with excellent results.
  • QOI: A fast, lossless format built for speed when file size is less of a concern.

💬 Not sure which format to pick? Start with WebP. It’s widely supported, noticeably smaller than JPEG, and requires zero changes to your existing workflow. Use AVIF if you want the absolute best compression ratio available.


05Installing the Squoosh WordPress Plugin

Installation takes about two minutes and works exactly like any standard WordPress plugin:

  1. Download the plugin zip

    Grab the zip file from the download section at the bottom of this page.

  2. Go to Plugins in WordPress

    Navigate to Plugins > Add New Plugin > Upload Plugin.

  3. Upload the zip file

    Click “Choose File”, select the zip, then click “Install Now”.

  4. Activate the plugin

    Click “Activate Plugin”. That’s it. The editor is now available in your Media Library.

No API keys, no account creation, no configuration required to get started. Once activated, the plugin adds an “Edit with Squoosh” button directly in your media library row actions.


06How to Edit Images from the Media Library

Here’s the typical workflow:

  1. Go to Media > Library in your WordPress dashboard.
  2. Hover over any image in list view. You’ll see an “Edit with Squoosh” link appear in the row.
  3. Click it. A full-screen editor opens right inside WordPress, no new tab.
  4. Adjust compression quality, change the output format, and watch the live preview update in real time.
  5. When you’re happy with the result, click Save. The optimized image replaces the original, and a backup is stored automatically.
Squoosh WordPress Editor Modal Screenshot

Keyboard Shortcuts in the Editor

Two shortcuts worth knowing while the editor is open:

  • ESC: Close the editor without saving anything
  • Ctrl + S / Cmd + S: Save and replace the image immediately

How the Editor Talks to WordPress

The Squoosh editor runs inside an iframe, and a JavaScript bridge handles communication between it and WordPress. Here’s a simplified look at how the message passing works:

// Listens for messages from the Squoosh editor iframe
window.addEventListener('message', function(event) {

  if (event.data.type === 'squoosh-ready') {
    // Editor is loaded, pass the image URL to it
    loadImageFromUrl(imageUrl, attachmentId);
  }

  if (event.data.type === 'squoosh-image-data') {
    // User saved, send the compressed result back to WordPress
    saveToMediaLibrary(event.data);
  }

});

JavaScript

This bridge is what makes the in-dashboard experience seamless. You don’t interact with it directly. The plugin handles all of this automatically in the background.


07Bulk Image Conversion: Convert Your Entire Media Library at Once

If you have a library full of old JPEG files and want to convert all of them to WebP, the bulk conversion feature does exactly that without you touching each image individually.

Here’s how to run a bulk conversion:

  1. Go to Media > Library and switch to List View.
  2. Select the images you want to process using the checkboxes on the left.
  3. Open the Bulk Actions dropdown and choose Convert with Squoosh.
  4. Pick your target format and quality level in the conversion panel that appears.
  5. Click Apply. The plugin starts processing images through a queue in the background.
  6. A progress bar shows you how many images have been processed and how many are left.
Squoosh WordPress Bulk Conversion Screenshot

Each image runs through a hidden worker iframe, so your browser stays responsive while the conversion is happening. If one image fails for any reason, the queue continues and flags the failure at the end. You get a full summary showing how many succeeded and which ones had issues.

⚠️ Bulk conversion works best when you’ve set your PHP memory limit to at least 256MB in the plugin settings. Large images can run into timeout or memory errors if the server limits are too low.


08The Backup System: Nothing Gets Permanently Lost

Before the Squoosh WordPress Plugin modifies any image, it creates a backup. The backup is stored as a separate entry in your Media Library, fully intact with all the original file metadata.

To restore an image to its original state, you can either find the backup directly in the Media Library, or use the one-click restore option on the attachment edit screen.

Here’s a simplified version of the PHP backup function the plugin runs before every edit:

// Runs automatically before any image modification
public static function backup_original($attachment_id) {
  $original_file = get_attached_file($attachment_id);
  $backup_dir    = wp_upload_dir()['basedir'] . '/squoosh-backups/';

  // Create the backup directory if it doesn't exist yet
  if (!file_exists($backup_dir)) {
    wp_mkdir_p($backup_dir);
  }

  // Copy the original file to the backup location
  $backup_path = $backup_dir . basename($original_file);
  copy($original_file, $backup_path);

  // Register backup as a new WordPress media attachment
  return wp_insert_attachment(
    ['post_title' => 'Backup: ' . basename($original_file)],
    $backup_path
  );
}

PHP

In the plugin settings, you can choose whether backups stay in your Media Library permanently or get deleted automatically after a successful optimization. Both options are available depending on how much storage space you’re working with.


09Plugin Settings: What Each Option Does

The settings panel lives under Settings > Squoosh Editor in your WordPress dashboard. Here’s a clear breakdown of every option:

Setting What it controls
Replace Mode Choose whether the original image is backed up or deleted after optimization.
Auto-replace Content Automatically updates image references in posts and pages to point to the new optimized file.
Default Format Sets a preferred output format so you don’t have to choose it manually every time.
Default Quality Sets a default compression quality level (0 to 100) applied when opening the editor.
PHP Memory Limit Raises the memory available for image processing. The plugin can update your .htaccess file automatically.
Max Execution Time Extends the PHP time limit so bulk conversion jobs don’t time out on large batches.
Debug Mode Turns on detailed error logging. Use this only when troubleshooting a specific issue.
Squoosh WordPress Plugin Settings Screenshot

Most of these settings have sensible defaults that work for the majority of WordPress sites. You only need to adjust the PHP limits if you’re running into memory or timeout errors during bulk processing.


10Offline Mode and Service Worker Support

This is a feature most image plugins skip entirely. The Squoosh WordPress Plugin registers a service worker that caches the editor assets (including WebAssembly compression modules) directly in your browser.

What this means for you:

  • The editor loads noticeably faster on repeat visits because assets are already cached
  • If your internet connection drops mid-session, the editor continues to function
  • WebAssembly modules (the engines powering compression) don’t need to re-download every time you open the editor

🔧 Running into the editor not loading correctly? Clear the service worker cache. In Chrome: open DevTools > Application > Service Workers and click Unregister. Then reload the page.


11See the Savings: Compression Simulator

Move the quality slider below to get a realistic idea of how much file size the Squoosh WordPress Plugin can save you across different formats. These estimates are based on a typical 2MB JPEG photo:

Image Compression Simulator

Estimated sizes for a 2MB JPEG source file

Quality: 80

Low

High
Original

2.0 MB
baseline

WebP

840 KB
-58%

AVIF

520 KB
-74%

These are realistic estimates based on standard compression ratios for photographic content. Actual results vary by image content, but the savings are real and consistent.


12Who Should Use This Plugin

The Squoosh WordPress Plugin is useful for a wide range of WordPress users:

✍️ Bloggers and Content Creators
🛍️ E-commerce Store Owners
💻 WordPress Developers
🗂️ Site Administrators
📷 Photographers with Media Libraries

You don’t need to understand image compression to use it effectively. The defaults work well straight after activation, and the real-time preview makes it easy to find the right quality level without any guesswork.

If you manage multiple client WordPress sites, the bulk conversion feature alone is worth it. Running one conversion job across an entire media library is the kind of task that used to take hours of manual work.


13Ready to Optimize Your WordPress Images?

The Squoosh WordPress Plugin is available to download below. Install it, activate it, and start compressing. Your pages will load faster, your Core Web Vitals scores will improve, and your visitors will have a better experience.

14Download the Squoosh WordPress Plugin

Free to download. Works with any standard WordPress installation. No account required.

Squoosh WordPress v1.0.0 • 13.43 MB
20

Give it a try on a few images first to get a feel for the quality settings, then run a bulk conversion on the rest. The backup system means there’s no risk to your existing files.

How did this post feel?

Share this with your dev circle

Found this useful? Boost another developer by sharing it forward.

Link copied to clipboard