LiteSpeed Cache for WordPress: Safe Defaults for Speed (Woo Included)
Author
John CavilIf your site already sits on LiteSpeed (nice choice), the LiteSpeed Cache (LSCache) plugin is your easiest path to big wins—TTFB down, LCP steady, checkout safe. Below is a battle-tested baseline you can copy, then tweak. It’s Woo-friendly, Elementor-aware, and plays nicely with Redis and Cloudflare.
Subtle flex: Pofii runs Pofii-Tuned LiteSpeed on NVMe hardware. The settings below map to how we ship fast defaults by design—no fragile hacks.
What LSCache Does (and what it doesn’t)
- Page Cache (HTML): Serves full pages to anonymous visitors lightning-fast.
- ESI (Edge Side Includes): Keeps dynamic bits (cart, login, wishlist) uncached while caching the rest.
- Optimization: Minify/defer CSS/JS, critical CSS, image placeholders, lazy-load, HTTP/3 goodies.
LSCache does not replace Object Cache. Pair it with Redis for database speed-ups (see our guide: WordPress Object Cache: Redis vs Memcached).
Prerequisites
- Server: LiteSpeed Enterprise or OpenLiteSpeed.
- Plugin: “LiteSpeed Cache” (latest).
- WooCommerce: Up-to-date; theme not hard-caching dynamic fragments.
- Optional: CDN (Cloudflare or QUIC.cloud). If you use Cloudflare, read: Cloudflare for WordPress: get maximum out of it.
Core Cache Settings (Safe Defaults)
Cache → Cache:
- Enable Cache: On
- Cache Mobile: On (separate mobile view if your theme differs)
- Cache Logged-in Users: Off (unless you’re doing careful role caches)
- Cache REST API / Login Page: On (REST helps block themes; login page can be cached page chrome, not the action)
Cache → TTL:
- HTML:
1200–3600s(20–60 min) - Static (CSS/JS/images):
7–30 days(long, with cache-busting)
Cache → Purge:
- Purge All On Upgrade: On
- Auto Purge Rules For Publish/Update: On (home, categories, tags, recent posts)
- Add custom purge for key landing pages if they list latest products/posts.
Cache → Excludes (important for Woo):
- URLs:
/cart/,/checkout/,/my-account/ - Cookies:
woocommerce_items_in_cart,wp_woocommerce_session_ - User Agents: leave default
WooCommerce: Keep Carts/Checkout Fresh
ESI → Enable ESI: On
- ESI Nonces: On
- ESI for Cart/Account Blocks: On (or theme-specific widgets)
Why: You cache the layout and product content but keep mini-cart/login dynamic. That’s how you get speed and correctness.
CSS/JS Optimization (Start Conservative, Then Turn Up)
Page Optimization → CSS:
- Minify CSS: On
- Combine CSS: Off (start off; combine only if you know your theme tolerates it)
- Generate Critical CSS (CCSS): On (QUIC.cloud service)
- Remove Unused CSS (UCSS): On (test; exclude admin/editor routes)
Page Optimization → JS:
- Minify JS: On
- Combine JS: Off (modern HTTP/2/3 doesn’t need it)
- Load JS Deferred: On
- Delay JS: On (add exceptions for essential scripts if something breaks)
Media → HTML:
- Lazy Load Images: On
- Generate Responsive & LQIP/Placeholder: On (prevents CLS)
- Add Missing Sizes: On (or define width/height in theme)
Using Elementor? Pair this with our guide: What Is Elementor and How to Speed It Up.
Images & Formats (WebP/AVIF)
Image Optimization:
- Optimize Originals & Thumbs: On
- Create WebP: On (serve via rewrite rules or CDN)
- If your CDN does WebP/AVIF automatically, don’t double-optimize—choose one path.
For store performance, also see: WooCommerce Image Speed.
CDN & Cloudflare: Play Nice
If you’re on Cloudflare:
- Don’t cache HTML for logged-in users.
- Respect origin
Cache-Control. - Bypass
/wp-admin,/cart/,/checkout/, previews, and query strings like?preview=true. - Use Cache Rules (new) not legacy Page Rules.
- Vary image cache by
Acceptif serving WebP/AVIF.
Full walkthrough: Cloudflare + WordPress settings that actually speed things up.
Object Cache: Redis for Dynamic Speed
- Enable Redis server-side; in WordPress, install the Redis drop-in and set a unique prefix.
- Keep page cache + object cache together. Page cache = anonymous visitors; object cache = DB work.
- Guide: Redis vs Memcached (setup + validation).
Crawler, Heartbeat & Database
Crawler:
- On, but gentle schedule. Don’t hammer origin. Useful to keep popular pages warm.
Heartbeat Control:
- Reduce frequency on front-end/admin if your editors don’t need real-time locks.
DB Optimization:
- Use LSCache’s DB tools sparingly; always back up first.
Validation Checklist (2 Minutes)
- Open a product/category page in an incognito window.
- Response headers: look for
x-litespeed-cache: hit(subsequent views). - TTFB: should drop on repeat view.
- LCP/CLS: test with Lighthouse.
- Woo flows: add-to-cart, mini-cart, checkout, login—no caching weirdness.
- If migrating: do it clean using our guide: Zero-Downtime DNS TTL Playbook or the long form: How to Migrate to a New Host.
Copy-Paste Baseline (start here)
Cache
- Enable: On
- Mobile: On
- Logged-in cache: Off
- TTL HTML: 1200–3600s
- Purge on update: On
- Exclude:
/cart/,/checkout/,/my-account/; cookieswoocommerce_items_in_cart,wp_woocommerce_session_
ESI
- Enable: On; Nonces: On; cart/login widgets via ESI
Optimization
- CSS: Minify On, Combine Off, CCSS On, UCSS On (test)
- JS: Minify On, Combine Off, Defer On, Delay On
- Media: Lazy-load On, placeholders On, WebP On (or CDN transforms)
CDN
- Respect origin headers; bypass logged-in/admin/cart/checkout; vary images by
Accept
Object Cache
- Redis enabled; unique prefix; pair with LSCache
FAQ
Does LSCache replace Redis?
No. LSCache accelerates pages; Redis accelerates queries. Best results come from both.
My cart header doesn’t update—why?
Your mini-cart is cached. Enable ESI for cart fragments or exclude the widget region from cache.
Should I combine CSS/JS?
Usually no with HTTP/2/3. Start with minify + defer; combine only if you know a bundle helps.
Why is my LCP still high?
Check your hero image priority and image sizes. See: WooCommerce Image Speed.
Leave a Comment