Performance & Caching
WordPress Intermediate/Advanced
Chapter 9 · Performance & Caching
WordPress Fundamentals 6 named caching plugins as an essential category without explaining why they matter so much specifically for WordPress. This chapter explains exactly that — and maps every technique directly onto Performance & Core Web Vitals's own LCP, INP, and CLS metrics, rather than treating "performance" as one vague, undifferentiated goal.
Why WordPress Specifically Has a Performance Problem
Per WordPress Fundamentals 1's own LAMP-stack material, every WordPress page load, by default, involves real PHP execution and real MySQL queries — WordPress rebuilds the page dynamically on every single request unless something intervenes. A static HTML file requires none of this; a default WordPress page genuinely does, every time, for every visitor.
Page Caching — The Single Biggest Lever
Page caching stores the fully-rendered HTML output of a page after its first generation, then serves that static copy directly for subsequent requests — skipping PHP execution and MySQL queries entirely for every visitor after the first.
Object Caching — A Different, Complementary Layer
Page caching mostly benefits anonymous, logged-out visitors — logged-in users often see personalized dashboard content that can't be cached wholesale the same way. Object caching solves a related but different problem: caching the results of individual, expensive database queries in memory, so the same query run repeatedly across many requests doesn't have to hit MySQL every single time.
Image Optimization — Also Mostly an LCP Story
The largest visible element on a page is very often an image — a hero image, a featured post image — making image handling directly relevant to LCP as well.
- Lazy loading — deferring images below the initial viewport until they're actually needed, via the native
loading="lazy"attribute - Responsive images — serving an appropriately-sized image per device, using the
srcsetattribute WordPress automatically generates from the multiple image sizes WordPress Fundamentals 7 already covered - Compression — reducing file size without materially harming visual quality, often handled by a dedicated plugin
CLS — A WordPress-Specific Risk Worth Naming
INP — A Lighter Touch, Tying Back to Chapter 7
Unnecessary or poorly-optimized JavaScript execution is the primary driver of poor INP. WordPress Intermediate/Advanced 7's own proper enqueuing material — loading scripts in the footer, only enqueuing what a specific page actually needs — is directly relevant here; INP isn't a separate new problem so much as a real-world payoff of getting Chapter 7's own material right.
Mapping Techniques to Metrics
| Technique | Primarily helps |
|---|---|
| Page caching | LCP (server response time) |
| Object caching | LCP, indirectly, for dynamic/logged-in content page caching can't cover |
| Lazy loading, responsive images, compression | LCP |
| Preserving width/height on images | CLS |
| Proper script enqueuing (Chapter 7) | INP |
Hands-On Exercises
A site enables page caching, but visitors keep seeing an old version of a post for hours after it was edited. Explain what's most likely wrong, using this chapter's own material.
📄 View solutionExplain why page caching alone doesn't solve performance for logged-in users, and what a persistent object cache adds that WordPress's own built-in object cache doesn't.
📄 View solutionA custom theme's own image-output code strips out the width and height attributes WordPress normally adds automatically. Explain which specific Core Web Vitals metric this most directly harms, and why.
📄 View solutionChapter 9 Quick Reference
- WordPress rebuilds pages dynamically via PHP/MySQL on every request by default, unlike a static file
- Page caching — the single biggest LCP lever, skipping PHP/MySQL entirely on repeat requests; cache invalidation is the classic hard problem
- Object caching — caches individual query results, benefits logged-in/dynamic content page caching can't cover; needs a persistent backend (Redis/Memcached) to help across requests
- Lazy loading, responsive srcset images, and compression are all primarily LCP techniques
- Missing width/height attributes on images is a real, WordPress-specific CLS risk
- Proper script enqueuing (Chapter 7) is directly what improves INP
- Next chapter: Capstone — Building a Custom Theme With a Custom Post Type