Overview
When a visitor requests a page on an un-cached WordPress site, the server must boot the PHP engine, query the MySQL database dozens of times, parse templates, execute active plugins, and compile the final HTML document. This execution cycle consumes CPU threads and memory, resulting in higher latency and reduced server capacity during traffic surges.
LiteSpeed Cache for WordPress (LSCache) pairs a WordPress administration plugin with LiteSpeed Web Server’s native server-level caching engine. Because cached HTML pages are served directly by the web server at the kernel level without invoking PHP or querying MySQL, page response times can drop dramatically. Every WordPress hosting plan at Web Hosting Wale runs on LiteSpeed Web Server, so the plugin can use this server-level cache.
In this tutorial, you will learn how to install and safely configure LiteSpeed Cache, enable server-level page caching, configure browser caching, understand object caching, safely tune frontend CSS/JS assets, and verify that your pages are actively hitting the cache.
[!IMPORTANT] Aggressive optimization settings (such as combining all JavaScript or inline CSS) can break theme layouts and interactive scripts. Enable optimization features incrementally and test your website in a private/incognito browser window after each change. Do not expect instant 100/100 benchmark scores solely from enabling a caching plugin.
Step 1: Install and Activate the LiteSpeed Cache Plugin
If your hosting environment does not pre-install the plugin, install it directly from the official WordPress repository:
- Log in to your WordPress dashboard as an administrator.
- Navigate to Plugins > Add New Plugin.
- Search for
LiteSpeed Cache. - Locate the plugin authored by LiteSpeed Technologies and click Install Now.
- Click Activate.
Upon activation, a new LiteSpeed Cache menu appears in your WordPress administration sidebar.
Step 2: Enable Core Server-Level Page Caching
The core value of LiteSpeed is its server-level page cache:
- In the WordPress sidebar, go to LiteSpeed Cache > Cache.
- On the [1] Cache tab, configure the following baseline settings:
- Enable Cache: Toggle to ON. This instructs LiteSpeed Web Server to store and serve compiled HTML snapshots for non-logged-in visitors.
- Cache Logged-in Users: Set to OFF for standard content websites. If enabled, logged-in users get cached views, which can cause administrative or member dashboard discrepancies unless role-based caching is explicitly configured.
- Cache Commenters: Set to OFF to ensure users who leave a comment immediately see their moderation notice.
- Cache REST API: Set to ON to cache public REST requests made by themes and mobile clients.
- Cache Login Page: Set to ON to reduce server load from automated brute-force bots hitting
wp-login.php. - Cache favicon.ico: Set to ON.
- Cache PHP Resources: Set to ON.
- Click Save Changes.
Step 3: Configure Time to Live (TTL) & Cache Purging
TTL determines how long cached HTML pages remain valid before the server purges them and generates a fresh snapshot:
- Navigate to the [2] TTL tab:
- Default Public Cache TTL: 604800 seconds (7 days) is standard for most content sites.
- Default Front Page TTL: 604800 seconds.
- Default Feed TTL: 0 or 259200 seconds (3 days).
- Navigate to the [3] Purge tab:
- Purge All On Upgrade: Set to ON so core, plugin, or theme updates automatically clear stale caches.
- Auto Purge Rules For Publish/Update: Ensure Front page, Home page, Pages, and All categories are checked. When you publish a new article or edit a page, LSCache will automatically invalidate only the relevant views rather than dumping your entire site cache.
- Click Save Changes.
Step 4: Configure Browser Caching
Browser caching instructs visitors’ web browsers to store static files (images, CSS, JavaScript, web fonts) locally on their device, eliminating repeat HTTP downloads during navigation:
- Go to the [5] Browser tab in the Cache settings.
- Browser Cache: Set to ON.
- Browser Cache TTL: Set to
2592000seconds (30 days). - Click Save Changes.
This setting adds standard Cache-Control and Expires HTTP headers to static asset responses served by LiteSpeed.
Step 5: Understanding Object Caching (Redis vs. Memcached)
It is critical to distinguish between Page Caching and Object Caching:
- Page Caching: Stores complete, pre-rendered HTML documents. Ideal for static visitors and public readers.
- Object Caching: Stores individual database query results (such as WordPress transients, user metadata, and options table values) in high-speed RAM.
LiteSpeed Cache provides an [6] Object cache configuration tab. However, object caching requires an active Redis or Memcached in-memory server running on your hosting environment.
[!NOTE] Do not enable Object Cache unless your hosting plan explicitly includes and has an active Redis or Memcached instance configured. Turning on Object Cache with incorrect host/port credentials will cause WordPress database timeouts. If Redis is available on your hosting plan, configure Host as the local server loopback address or Unix socket path (e.g.,
redis.sock), set the port (default6379for Redis), and test the connection before enabling.
Step 6: Safe Frontend Asset Optimization (Page Optimization)
The Page Optimization section minifies and tunes CSS, JavaScript, and HTML. Aggressive settings here are the most frequent cause of broken layouts. Proceed with measured caution:
CSS Settings
- Navigate to LiteSpeed Cache > Page Optimization > [1] CSS Settings.
- CSS Minify: Set to ON. This removes whitespace and comments from stylesheets without altering CSS logic.
- CSS Combine: Start with OFF. Combining multiple third-party plugin stylesheets into a single massive file can cause CSS specificity conflicts and render-blocking delays on HTTP/2 or HTTP/3 servers.
- CSS HTTP/2 Push: Set to OFF (deprecated in modern web standards).
- Click Save Changes and verify your website in an incognito window.
JS (JavaScript) Settings
- Navigate to the [2] JS Settings tab.
- JS Minify: Set to ON.
- JS Combine: Set to OFF. Combining modern asynchronous JavaScript modules frequently breaks dynamic widgets, sliders, and checkout forms.
- JS Defer: If your site is content-heavy, you can test setting this to Deferred. However, if navigation menus or forms stop functioning, revert to OFF.
- Click Save Changes.
HTML Settings
- Navigate to the [4] HTML Settings tab.
- HTML Minify: Set to ON.
- DNS Prefetch: Add third-party domains you rely on (e.g.,
//fonts.googleapis.com,//www.googletagmanager.com) to initiate early DNS resolution. - Click Save Changes.
Step 7: Verifying Cache Hits via HTTP Response Headers
Never rely solely on visual inspection to confirm that caching is active. Inspect the HTTP response headers using your browser’s Developer Tools or command line:
Using Browser Developer Tools
- Open an Incognito / Private browser window (to ensure you are not logged in as an administrator).
- Open your website:
https://example.com/. - Press
F12(or right-click and select Inspect) and open the Network tab. - Reload the page once to populate the cache, then reload a second time.
- Click on the primary HTML document request (the first item named
example.com). - Look under Response Headers for the LiteSpeed header:
x-litespeed-cache: hit
| Header Value | Meaning |
|---|---|
x-litespeed-cache: hit |
The page was served directly from the server-level LSCache engine without executing PHP. |
x-litespeed-cache: miss |
The page was dynamically generated by PHP, and a fresh copy was saved to the cache. |
x-litespeed-cache: bypass |
Caching was skipped (e.g., user is logged in, a shopping cart cookie is active, or a no-cache directive exists). |
Using curl in the Terminal
You can also verify cache response status directly from your command line:
curl -I https://example.com/
Look for x-litespeed-cache: hit in the terminal output.
Purging Caches After Site Edits
When you update theme designs, edit global headers, or adjust CSS files, changes may not immediately appear because visitors are receiving cached snapshots:
- Look at the top WordPress admin toolbar for the green LiteSpeed icon.
- Hover over the icon and select:
- Purge All: Clears all cached pages across the entire website.
- Purge All - LSCache: Clears all server-level HTML pages.
- Purge All - CSS/JS Cache: Clears combined and minified stylesheet/script bundles.
- For more comprehensive troubleshooting across CDN and browser layers, consult our guide on how to clear website cache.
Frequently Asked Questions
Will configuring LiteSpeed Cache guarantee a 100/100 Google PageSpeed score?
No. Caching significantly accelerates server response times and static delivery, but overall Google PageSpeed and Core Web Vitals scores also depend on theme weight, third-party analytics trackers, font loading strategies, and mobile rendering performance.
Does installing LiteSpeed Cache work on Apache or Nginx servers?
While the LiteSpeed Cache plugin can be installed on standard Apache or Nginx servers, its primary feature, server-level page caching via the LSCache server engine, requires LiteSpeed Web Server (or OpenLiteSpeed). On other servers, only basic optimization features function unless specialized server modules exist.
Why did my website layout or drop-down menu break after enabling CSS/JS minification?
Aggressive JavaScript combination or deferred loading can alter script execution order, causing dependent libraries (like jQuery) to fail before inline scripts execute. When an asset optimization breaks design or functionality, disable JS Combine and test individual script exclusions.
Need Technical Assistance?
Web Hosting Wale support is available 24/7. Tickets are typically answered within 10-15 minutes.