How do I optimise WordPress images automatically?

Reading Time: 2 minutes

TL;DR: Compress on upload with an optimisation plugin, serve WebP or AVIF with fallbacks, resize to the largest size you display, enable lazy loading, and set explicit dimensions to prevent layout shift.

Images are usually the heaviest part of a WordPress page, and the wins come from a pipeline rather than a single plugin.

Step 1 Stop uploading camera originals

Decide the maximum display width for your content area and resize before upload. A 6000-pixel photograph displayed at 1200 pixels wastes bandwidth no matter how well it is compressed. This habit removes most of the problem.

Step 2 Add compression on upload

Install a reputable optimisation plugin such as ShortPixel, Imagify or Smush and configure automatic compression for new uploads. Sensible lossy compression is visually indistinguishable for photographs and dramatically smaller.

Step 3 Bulk-optimise the existing library

Run a pass over previously uploaded images, since historical uploads are often the heaviest assets on an established site.

Step 4 Serve modern formats with fallbacks

Enable WebP delivery, or AVIF where your stack supports it, with automatic fallback for older browsers. Verify in devtools that the modern format is actually served, not merely generated.

Step 5 Use responsive sizes correctly

Ensure your theme outputs srcset and sizes so browsers pick an appropriately sized file. A theme hardcoding a single large image URL defeats WordPress’s built-in responsive behaviour.

Step 6 Lazy load below the fold, not above it

Native lazy loading is enabled by default in recent versions. Exclude your largest above-the-fold image, because delaying it worsens Largest Contentful Paint. This nuance is where many well-intentioned optimisations backfire.

Step 7 Set dimensions to control layout shift

Always include width and height attributes, or use aspect-ratio in CSS, so the browser reserves space before the image arrives. Unexpected movement as images load is one of the most damaging Core Web Vitals problems.

Step 8 Offload, cache and measure

Serve images through a CDN if your audience is geographically spread, set long cache lifetimes, and consider object storage for very large libraries. Measure before and after with PageSpeed Insights so you know which change actually helped.

Back to How-To

Was this helpful?

Thanks for your feedback!

Comments are closed