Home / Guides / WordPress handbook / Chapter 14
WordPress handbook · Chapter 14 · Infrastructure
Performance Optimisation and Core Web Vitals
Speed has two halves. Server-side speed is how fast the HTML arrives; front-end speed is how fast the browser can turn that HTML into a usable page. Most WordPress performance advice mixes the two up, so people install a fifth optimisation plugin to fix a slow database. This chapter separates them, explains how each is measured, and gives an order of work that fixes the biggest problem first.
On this page
Measure before you optimise
There are two kinds of measurement, and they answer different questions:
- Lab data (PageSpeed Insights' Lighthouse section, Lighthouse in Chrome DevTools, WebPageTest) loads a page once under fixed, simulated conditions. It is repeatable and diagnostic: it tells you why a page is slow.
- Field data (the Chrome User Experience Report shown at the top of PageSpeed Insights, Search Console's Core Web Vitals report, real-user monitoring) records what real visitors experienced over the previous 28 days. It is what Google uses for its page-experience signals, and it is what your customers actually feel. It changes slowly after fixes.
A lab score of 100 with poor field data means real visitors have slower devices, networks or pages than the test. A poor lab score with good field data is usually not urgent. Always test the templates that matter (home, product, article, checkout), on mobile settings, logged out, and with a warm cache as well as a cold one.
Server timing first
for i in 1 2 3 4 5; do curl -s -o /dev/null -w "TTFB %{time_starttransfer}s total %{time_total}s code %{http_code}\n" https://example.com/; done
# Bypass page cache to see raw WordPress generation time (adds a unique query string):
curl -s -o /dev/null -w "uncached TTFB %{time_starttransfer}s\n" "https://example.com/?nocache=$(date +%s)"
As a rough guide, cached HTML should arrive in well under 200 ms from a nearby location, and uncached WordPress pages in under about 600–800 ms. If uncached generation takes several seconds, no front-end plugin will fix it; go to server-side performance. Note that some caches ignore query strings, so the bypass trick may not work everywhere; logging in also bypasses most page caches.
Core Web Vitals explained
| Metric | What it measures | "Good" threshold (75th percentile) | Common WordPress causes of poor scores |
|---|---|---|---|
| LCP: Largest Contentful Paint | When the largest visible element (usually the hero image or headline) finishes rendering | ≤ 2.5 s | Slow server response; hero image lazy-loaded or huge; render-blocking CSS; web fonts delaying text; sliders loading many images |
| INP: Interaction to Next Paint | How quickly the page responds visually to clicks, taps and key presses, across the visit | ≤ 200 ms | Heavy JavaScript from builders, sliders, chat widgets, tag managers and ad scripts; long tasks on the main thread; large DOM |
| CLS: Cumulative Layout Shift | How much visible content jumps around unexpectedly | ≤ 0.1 | Images and embeds without width/height; late-loading banners, cookie bars and ads pushing content; web fonts swapping with different metrics |
INP replaced First Input Delay as a Core Web Vital in March 2024. Supporting metrics such as TTFB (time to first byte) and FCP (first contentful paint) are diagnostic, not ranking metrics, but a slow TTFB drags LCP down with it.
Server-side performance: making WordPress generate pages faster
- Modern PHP with OPcache. Each major PHP release has brought measurable speed improvements. Confirm OPcache is enabled and not full (Chapter 06).
- Page caching for anonymous traffic. One layer, correctly purged, with transactional pages excluded. This is the single biggest win for most sites.
- Persistent object cache (Redis/Memcached) for logged-in, WooCommerce, membership and LMS traffic, which page caching cannot help.
- Find slow components with Query Monitor on staging: slowest queries, duplicate queries, HTTP API calls made during page generation, and the hooks consuming the most time. A single plugin making a 2-second external call on every page is common.
- Autoloaded options: check their total size (Chapter 08). Megabytes of autoloaded data slow every uncached request.
- Database health: oversized log/session tables, missing indexes on custom tables, Action Scheduler backlogs.
- Move work out of page loads: imports, feed generation, emails and syncs into background jobs; WP-Cron onto a system cron.
- Capacity: only after the above, check PHP worker limits and CPU/RAM against traffic (Chapter 06).
The number of plugins matters less than what they do on each request. Ten small, well-written plugins can cost less than one plugin that queries every order on every page. Measure per-plugin cost instead of counting plugins.
Front-end performance: assets, images, fonts and scripts
CSS
- Render-blocking CSS delays first paint. Critical CSS (inlining the styles needed above the fold and loading the rest later) helps LCP, but must be regenerated when designs change.
- Unused CSS removal shrinks stylesheets but can drop styles used only after interaction (menus, modals, tabs, dynamically inserted classes). Always keep a safelist.
- Combining stylesheets mattered under HTTP/1.1; with HTTP/2 and HTTP/3 it rarely helps and often breaks cascade order. Prefer minify without combine.
JavaScript
deferlets scripts download in parallel and run after parsing, in order. It is safe for most scripts and improves LCP.asyncruns scripts as soon as they arrive, out of order. It is only for independent scripts such as analytics.- Delay until interaction holds scripts until the user scrolls or clicks. It produces excellent lab scores but often breaks real features (Chapter 03), and can hurt INP because all the delayed scripts run at the first interaction. Use it selectively for third-party widgets, never for consent, payment, CAPTCHA or navigation scripts.
- Third-party scripts (chat widgets, heatmaps, tag managers carrying many tags, social embeds, video players) are usually the largest INP cost. Audit them quarterly and remove what nobody uses.
Images
- Serve appropriately sized images. WordPress generates sub-sizes and
srcsetautomatically; make sure themes use them instead of full-size originals. - Use modern formats (WebP widely, AVIF where supported) through one system (Chapter 13 lists the overlaps).
- Never lazy-load the LCP image. WordPress core avoids lazy-loading the first content images and adds
fetchpriority="high"to the likely LCP image; plugins that force lazy-loading on everything undo this. - Always include
widthandheight(or CSS aspect-ratio) to prevent layout shift. - Replace sliders on the home page with a single static hero; sliders cost LCP, INP and usually conversions too.
Fonts
- Host fonts locally (avoids extra DNS/TLS to font services and helps privacy compliance), limit families and weights, use WOFF2.
- Preload only the one or two fonts used above the fold. Use
font-display: swap(oroptional) with fallback fonts sized to match, to reduce CLS. - Icon fonts (whole Font Awesome sets for three icons) are a common waste; use inline SVG.
Video and embeds
Replace YouTube/Vimeo iframes with a lightweight placeholder that loads the player on click ("lite embeds"). Maps and social embeds can be handled the same way, which also simplifies cookie consent.
Page builders, themes and DOM size
Builders wrap content in many nested containers, and every element costs style calculation and layout time. Very large DOMs (thousands of nodes) hurt INP and memory on phones. Practical measures:
- Use the builder's performance settings: optimised DOM output, flexbox containers instead of nested sections, loading only widget assets used on the page, and disabling unused widgets globally.
- Remove add-on packs whose widgets are barely used.
- Keep mega-menus and footers lean, since they appear on every page.
- For new builds, lighter block themes with a small block library often reach good Core Web Vitals with far less tuning.
WooCommerce performance specifics
- Enable High-Performance Order Storage (HPOS) when all extensions are compatible; order queries become much faster on large stores.
- Keep cart, checkout and account uncached, but make sure product, category and content pages are cached for anonymous visitors.
- Limit cart fragments to pages with a mini-cart (Chapter 03).
- Product filters with many attribute combinations are database-heavy; use plugins built on lookup tables and limit crawler access.
- Watch Action Scheduler: failing jobs pile up and slow admin screens.
- Use a persistent object cache: logged-in customers and carts are dynamic by nature.
Performance troubleshooting by symptom
| Symptom | Most likely cause | Check | Fix |
|---|---|---|---|
| Slow for everyone, every page | Page cache not working, or slow server | Cache headers; uncached TTFB | Fix the cache layer; then server-side profiling |
| Fast logged out, slow logged in / wp-admin | Slow plugins, autoloaded options, no object cache, Heartbeat | Query Monitor in admin; autoload size | Object cache; fix slow plugin; reduce Heartbeat frequency |
| Slow at specific times | Backups, scans, cron jobs, crawler bursts | Correlate with schedules and access logs | Reschedule jobs; rate-limit crawlers |
| Good lab score, poor field LCP | Real users on slow devices/networks; uncached first visits; geographic distance | Field data by device; CDN coverage | CDN for HTML where safe; lighter hero; less JS |
| Poor INP | Heavy third-party or builder JavaScript | Performance panel in DevTools (long tasks) | Remove/defer third parties; simplify interactive widgets |
| Poor CLS | Images without dimensions, late banners, font swaps | Layout shift regions in DevTools | Reserve space; dimensions; font fallbacks |
| Slow only on product filters or search | Expensive queries, unlimited variants | Slow query log; access logs | Indexed filtering; search plugin; crawl limits |
| Slow after an update | New plugin behaviour or regression | Compare with staging on old version | Roll back; report to vendor |
Performance checklist
- Field data (Search Console / PageSpeed Insights) reviewed for mobile and desktop.
- Supported PHP version with OPcache enabled and not full.
- Exactly one page-cache layer, verified by response headers, with transactional pages excluded.
- Persistent object cache for dynamic or logged-in traffic.
- Autoloaded options under control; log and session tables pruned.
- No slow external HTTP calls during page generation (Query Monitor).
- WP-Cron moved to a system cron for busy sites.
- One CSS/JS optimiser; exclusions documented.
- LCP image not lazy-loaded, correctly sized, in a modern format.
- All images and embeds have dimensions; banners reserve space.
- Fonts self-hosted, limited, preloaded only above the fold.
- Third-party scripts audited; unused ones removed.
- CDN in place for static assets (and HTML where safe).
Rather have someone else keep WordPress healthy?
Our managed hosting and care plans cover updates, backups, security monitoring and fixes like the ones in this handbook, so you can get on with running the business.
See Hosting & Care