Mastodon

WordPress Caching Explained: Page Cache, Object Cache, and Browser Cache

  1. Home
  2. Blog
  3. WordPress Caching Explained: Page Cache, Object Ca...

Without caching, every single request to your WordPress site triggers a chain of work: PHP executes, the database runs queries, the template engine assembles HTML, and only then does the server send a response. For a site receiving a few dozen visitors a day, this is manageable. For a site with real traffic, it quickly becomes the reason pages are slow and servers struggle under load.

Caching is the practice of storing the output of expensive operations so that future requests can retrieve the stored result instead of repeating the work. Done correctly, it is the single highest-impact performance improvement available to a WordPress site. Done incorrectly, it serves stale content to users, breaks dynamic features, or adds complexity without meaningful benefit.

This guide explains every significant type of WordPress caching, how each one works, where it applies, and how to set it up. If you have ever wondered what the difference is between page caching and object caching, or whether you need a plugin or whether your host already handles it, this covers all of it.

Why WordPress Needs Caching

WordPress is a dynamic system. Every page is constructed on request from a combination of database content, PHP logic, and template markup. This architecture is what makes WordPress flexible, but it means that serving a page requires multiple round trips between PHP and the database before a single byte of HTML reaches the user. A typical WordPress page load triggers anywhere from 20 to 100 database queries depending on the theme, active plugins, and the complexity of the content.

For common pages that many visitors see, this work is largely redundant. The homepage content does not change between one visitor and the next, but without caching, WordPress performs the same assembly work for each of them. The database runs the same queries, PHP executes the same logic, and the same HTML is generated, discarded, and generated again thousands of times per day. Caching breaks this cycle by storing the assembled output and serving it directly, skipping the underlying work for all but the first request after the cache is created or invalidated.

Page Caching

Page caching is the most impactful type of caching for front-end WordPress performance. It stores a complete HTML copy of each page as a static file after the first request, then serves that static file directly to subsequent visitors without involving PHP or the database at all. A cached page can be served in a few milliseconds. An uncached WordPress page typically takes anywhere from 300ms to several seconds to generate, depending on the server and the site's complexity.

The mechanism works by intercepting requests before WordPress boots and checking whether a cached version of the requested URL exists. If one does, it is returned immediately. If one does not, or if the cached version has expired, WordPress runs its normal generation process and the result is saved for next time. Most page caching plugins achieve this by adding a small piece of code to .htaccess that intercepts requests at the web server level, before PHP runs at all.

Page caching is most effective for static or semi-static content: blog posts, informational pages, category archives, and homepages that do not change frequently. It cannot be applied to pages that are personalised per user, such as account dashboards, shopping carts, and checkout pages, because the content differs between users and serving a cached version would show the wrong data.

Setting up page caching in WordPress: The fastest path is to use a caching plugin.

WP Super Cache is free, straightforward, and has been maintained reliably for over a decade. It is a solid choice for most sites that just need page caching without additional complexity.

WP Rocket is a premium plugin that combines page caching with a comprehensive set of additional performance features, including minification, deferral, and lazy loading. It is the easiest option to configure correctly and the one most managed hosting guides recommend.

LiteSpeed Cache is free and extremely capable if your host runs LiteSpeed web server. It integrates at the server level rather than via .htaccess rules, which makes it faster than most plugin-based alternatives. Some managed WordPress hosts run LiteSpeed specifically because of this.

If your hosting provider offers server-level page caching built into the platform, that is usually preferable to any plugin-based approach because it operates at a lower level and avoids PHP entirely.

Object Caching in WordPress

Object caching stores the results of expensive PHP operations and database queries in memory so they can be reused across multiple requests without re-executing the underlying work. Where page caching helps anonymous front-end visitors, object caching helps every type of request including admin screens, AJAX calls, WooCommerce operations, and API requests that cannot be page-cached.

WordPress has a built-in object cache, but by default it only persists for the duration of a single page request. Every new request starts with an empty cache. A persistent object cache changes this by connecting WordPress to an in-memory data store, typically Redis or Memcached, that retains cached data between requests. When WordPress needs a piece of data it has already fetched recently, it retrieves it from memory in microseconds rather than querying the database again.

The practical effect of persistent object caching is most noticeable in the admin panel. The WordPress dashboard performs a significant number of database operations to check for updates, load widget data, query post statistics, and verify options and settings. With an object cache, many of these queries are served from memory on subsequent requests, making the admin noticeably more responsive. WooCommerce stores benefit particularly strongly because the product catalogue, pricing rules, and inventory data are queried repeatedly across sessions.

How to Enable Object Cache in WordPress

Object caching requires your hosting environment to have Redis or Memcached available at the server level. Shared hosts typically do not offer this. Managed WordPress hosts generally do. On Arcadia, Redis is available on all plans.

To set it up: install the Redis Object Cache plugin by Till Krüss from the WordPress plugin directory (free, actively maintained). If your host requires connection details, add the following to wp-config.php above the "stop editing" line:

define( 'WP_REDIS_HOST', '127.0.0.1' );
define( 'WP_REDIS_PORT', 6379 );

Then enable the object cache from the plugin's Settings page. Once active, the plugin shows a cache hit rate in your dashboard: the percentage of requests served from memory rather than the database. A healthy hit rate is above 80% after the cache has warmed up.

You can verify which driver is active from the command line with wp cache type.

Redis vs Memcached for WordPress

Both are in-memory data stores and the performance difference in typical WordPress workloads is negligible. Redis has become the more commonly supported option among managed WordPress hosts, and the Redis Object Cache plugin by Till Krüss is the standard integration. If your host offers both, choose whichever they recommend. The cache driver matters far less than having a persistent object cache at all.

Browser Caching

Browser caching instructs visitors' browsers to store static assets locally after downloading them on the first visit. Images, stylesheets, fonts, and JavaScript files are the primary targets. On the first visit, the browser downloads these files from your server. On subsequent visits, it loads them directly from the local cache on disk, skipping the network request entirely.

The mechanism is controlled by HTTP response headers sent by your server. The Cache-Control header specifies how long a browser should treat a cached version of a file as valid before checking the server for a newer version. For assets like images that rarely change, setting a long cache duration of a year is common. For CSS and JavaScript files that may be updated more frequently, a shorter duration combined with cache-busting via versioned filenames is the standard approach. WordPress core and most quality plugins handle cache-busting for their own assets automatically by appending a version query string to file URLs.

Setting up browser caching: On Apache servers, browser caching is typically configured by adding directives to .htaccess. Most caching plugins include browser caching configuration as part of their setup. If you are managing your own server, adding the following to .htaccess in your WordPress root sets sensible defaults:

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType application/x-font-woff2 "access plus 1 year"
</IfModule>

On Nginx servers, equivalent configuration goes in your server block. If your host manages the server configuration, check whether browser caching is already enabled before adding your own directives, as duplication can cause unexpected behaviour.

OPcache (PHP Bytecode Caching)

OPcache works at the PHP level rather than the WordPress level. PHP is an interpreted language, which means every time PHP runs, it parses and compiles the source code of each file it executes before running it. On a busy WordPress site, the same files, including WordPress core, your theme, and every active plugin, are compiled on every request. OPcache eliminates this overhead by storing the compiled bytecode representation of PHP files in memory. Subsequent requests load the pre-compiled bytecode directly, bypassing the parsing and compilation step entirely.

OPcache is enabled by default on most modern hosting environments and does not require any WordPress-side configuration. You can verify it is active by installing the WP Server Info plugin or by asking your host. The performance benefit is consistent and meaningful: PHP execution time typically drops by 20 to 50 percent with OPcache enabled. If you are on hosting where it is not enabled, switching to a provider that enables it by default is a more effective solution than trying to configure it yourself.

CDN Caching

A Content Delivery Network distributes copies of your site's static assets across servers in multiple geographic locations around the world. When a visitor requests your site, static files like images, CSS, and JavaScript are served from the CDN server closest to their location rather than from your origin server. This reduces the physical distance data has to travel, which directly reduces latency and improves load times for visitors outside of your server's geographic region.

CDN caching is particularly valuable if your audience is global. A server located in London serves visitors in the UK quickly, but visitors in Australia or North America experience significantly higher latency because their requests have to travel further. A CDN with servers in Sydney and New York eliminates most of that latency for those visitors.

Some CDNs also offer full-page caching, where the entire HTML response is cached at the CDN edge rather than only static assets. Cloudflare is the most widely used CDN among WordPress sites and offers a free tier that includes both asset caching and optional full-page caching. BunnyCDN and KeyCDN are paid alternatives with strong performance and transparent pricing. Many managed WordPress hosts include a CDN as part of their hosting package.

Transient Caching

Transients are WordPress's built-in mechanism for caching arbitrary data with an expiry time. Plugins use transients to cache the results of slow operations: API responses, complex database queries, remote feed data, and calculated values that do not change frequently. The WordPress functions set_transient(), get_transient(), and delete_transient() are used by plugin developers throughout the ecosystem.

By default, transients are stored in the wp_options database table, which means they persist between requests but still require a database query to retrieve. When a persistent object cache like Redis is active, WordPress automatically routes transient storage through it instead, making transient retrieval significantly faster. This is one of the additional benefits of setting up a persistent object cache: you do not need to do anything differently to get it, it happens automatically.

How These Caching Layers Work Together

Each type of caching operates at a different level and addresses a different bottleneck, which is why a well-optimised WordPress site typically uses several of them simultaneously rather than relying on one. A practical setup for most WordPress sites looks like this: OPcache handles PHP compilation overhead, page caching eliminates database and PHP work for front-end requests, object caching speeds up admin operations and dynamic requests that cannot be page-cached, browser caching reduces repeat download overhead for static assets, and a CDN delivers those assets with low latency to visitors in every region.

Getting all of these working together is less complicated than it sounds. A good managed WordPress host will handle OPcache, object caching, and CDN setup as part of their platform, leaving you to configure only page caching via a plugin and browser caching via a plugin or hosting panel. The plugin configuration for page caching is usually a matter of enabling it and testing that your dynamic pages, cart, checkout, and user accounts are correctly excluded.

Arcadia Servers includes OPcache and full-page caching on all hosting plans. You do not need to install and configure multiple plugins to get a properly cached WordPress site. See what's included in our WordPress hosting plans.

When to Clear Your Cache

Caching serves stored versions of pages, which means changes you make in WordPress may not immediately appear to visitors until the cache clears. Most caching plugins clear the cache for a specific page automatically when that page's content is updated. They also typically provide a one-click option to clear the entire cache, which is useful after theme updates, plugin updates, or design changes that affect site-wide elements like the header and footer.

Get into the habit of clearing your cache after making any significant change and verifying the result in a private browsing window, which bypasses browser cache and shows you what a first-time visitor would see. It is a quick check that saves a lot of confusion when cached versions of old pages appear to persist.

Frequently Asked Questions

Do I need a caching plugin if my host already includes caching?

It depends on what your host's caching covers. If your host provides server-level full-page caching, you may not need a caching plugin for that layer. However, you may still benefit from a plugin for browser caching configuration, JavaScript and CSS minification and deferral, and image optimisation, which are related performance features that often come bundled with caching plugins but are separate from the cache itself. Check what your host specifically provides before installing a plugin to avoid duplication.

Does caching break WooCommerce?

It can if configured incorrectly. Pages like the cart, checkout, and My Account must be excluded from page caching because they contain user-specific data. WooCommerce-compatible caching plugins, including WP Rocket and LiteSpeed Cache, know which WooCommerce URLs to exclude automatically. If you are configuring caching manually, make sure you exclude /cart, /checkout, /my-account, and any other pages containing dynamic user data.

Will caching help my WordPress admin panel?

Page caching does not apply to admin screens, but object caching and OPcache both help significantly. If your admin panel is slow, a persistent object cache is one of the most effective improvements available. Combined with fast hosting and a well-maintained plugin set, it can make the difference between an admin panel that feels sluggish and one that responds almost instantly to navigation and actions.

Does caching work for logged-in users?

Page caching is typically bypassed for logged-in users because their sessions may contain personalised content such as account menus, saved carts, or admin bars. Most caching plugins handle this automatically.

Logged-in users still benefit from object caching and OPcache, which speed up database operations and PHP execution regardless of login state. If you run a membership site where logged-in performance matters, object caching is the most effective lever available.

How do I know if my WordPress cache is working?

The most reliable method is to inspect HTTP response headers. Open your browser's developer tools, go to the Network tab, reload your site, and click on the main HTML document. Look for headers like X-Cache: HIT, CF-Cache-Status: HIT (Cloudflare), or X-WP-Cache: 1. A HIT means the response was served from cache. A MISS means the cache was bypassed or the page was not yet cached.

You can also run your site through GTmetrix or WebPageTest before and after enabling caching. A properly cached page will show dramatically lower Time to First Byte, often dropping from several hundred milliseconds to under 50ms.

How long should WordPress pages be cached?

For most WordPress sites, a cache lifetime of 24 hours is a sensible default for blog posts and static pages. Content that changes frequently, such as a homepage with a live feed or a news site, benefits from a shorter lifetime of one to four hours.

The cache lifetime matters less than it might seem because quality caching plugins automatically purge the cache for a specific page whenever its content is updated in WordPress, so even with a 24-hour lifetime, a published edit appears to visitors within seconds.

What is the best free caching plugin for WordPress?

It depends on your hosting environment. LiteSpeed Cache is the strongest free option if your host runs LiteSpeed web server, as it integrates at the server level and outperforms plugin-only solutions. On Apache or Nginx, WP Super Cache is reliable and simple to configure correctly.

W3 Total Cache offers more granular control but has a more complex settings panel that can lead to misconfiguration if you are not familiar with caching concepts. If budget allows, WP Rocket is the premium option that combines the easiest setup with the most comprehensive feature set.

Can caching cause my WordPress site to show outdated content?

Yes, this is the inherent trade-off with caching: you are serving a stored copy of a page rather than generating it fresh. In practice, well-configured caching plugins minimise this by automatically purging the cache for any page or post the moment it is updated, published, or deleted.

Where stale content most often appears is after theme changes or plugin updates that affect site-wide elements like headers, footers, or sidebars. In those cases, use your caching plugin's option to clear the entire cache. Always verify changes in a private browsing window, which bypasses both the server cache and the browser cache, so you see exactly what a new visitor sees.

What is transient caching in WordPress?

Transient caching is WordPress's built-in system for plugins to store the results of slow or expensive operations with an expiry time. Rather than re-fetching an external API response or re-running a complex database query on every page load, a plugin stores the result as a transient and retrieves it directly on subsequent requests until the expiry passes.

Transients are stored in the database by default, but when a persistent object cache like Redis is active, WordPress automatically routes them through it instead. This makes transient retrieval near-instant without any additional configuration on your part.

Related Articles

Performance

Why Is the WordPress Block Editor Slow? 7 Causes & How to Fix Them

Gutenberg running slow? Learn the 7 most common causes and how to fix them, from...

Performance

How to Find Which WordPress Plugin Is Slowing Down Your Admin Dashboard

A slow WordPress dashboard is usually caused by a plugin, not your hosting. Here...

Performance

Why Is My WordPress Site So Slow? (Complete Fix Guide 2026)

A slow WordPress site can have many different causes. This guide covers every ma...