Skip to content
WP Cloud
WP Cloud
    • For Hosts
    • For Agencies
    • For Registrars
    • For Native Hosting
    • Performance
    • Security
    • Real-Time Automated Failover
    • Vertical Scaling and Bursting
    • WordPress Management
    • PanelAlpha Integration: White-Label WordPress Control Panel for Hosts
    • EasyEngine Panel Integration: Visual WordPress Management for WP Cloud
    • FAQs
    • WP Cloud API
    • Partner Portal
    • Documentation
    • New Partner Guide
    • Pressable
    • Convesio
    • Porkbun
    • PanelAlpha
    • Ivapix
    • UNC Greensboro
    • Impressive Hosting
    • Blog
    • Performance Benchmarks
  • Connect With Us
  • Login ↗
Start Here ↗
  • Solutions

    • For Hosts
    • For Agencies
    • For Registrars
    • For Native Hosting
    • Featured Partners

    Features

    • Performance
    • Security
    • Real-Time Automated Failover
    • Vertical Scaling and Bursting
    • WordPress Management

    Integrations

    • PanelAlpha Integration
    • Easy Engine Panel Integration

    Resources

    • Documentation
    • WP Cloud API
    • FAQs
    • Partner Portal
    • New Partner Guide
    • Announcements
    • Changelog
  • Case Studies
    • PressableA case study about how WP Cloud supports Pressable to power millions of page views daily.
    • Convesio
    • Porkbun
    • PanelAlpha
    • Ivapix
    • UNC Greensboro
    • Newspack
    • Inverse Paradox
  • Insights
    • Podcast
    • BlogWP Cloud blog page with latest news and updates about the platform.
    • Performance Benchmarks
  • Connect With Us
  • Login ↗
Start Here ↗

Browse

    • WP Cloud platform overview
    • Onboard and launch with WP Cloud
    • WP Cloud Partner Portal
    • Get support from WP Cloud
    • WP Cloud glossary
    • API Documentation
    • Manage and secure API keys
    • Client SSH
    • WP Cloud API quick start
    • Webhooks
    • Run bulk tasks across sites
      • Manage site domains and aliases
      • Domain verification records
      • TLS certificates
      • Manage custom TLS certificates
      • Cloudflare and WP Cloud
    • Clone a site
    • Configure resources, site type, and billing with site meta
    • Delete a site
    • Persistent data
    • Staging sites
    • Migrate a site to WP Cloud
      • SSH and SFTP access models
      • Client SSH
      • User SSH and SFTP access
      • Database credentials
      • phpMyAdmin
      • ABSPATH
      • Default wp-config.php
      • Site constants
      • Configure redirects and headers with custom-redirects.php
      • Akismet and Jetpack
      • Blocked and unsupported plugins
      • PHP lifecycle and supported versions
      • Symlinks and managed software
      • WordPress versions
      • Install Composer and WP-CLI packages
      • Manage platform software with WP-CLI
      • Useful WP-CLI commands
    • Transactional email
    • WordPress multisite
    • Cron scheduling
    • Decoupled and headless WordPress
      • Edge Cache preload
      • WooCommerce cart caching
      • Page Cache
      • Edge Cache
      • Object Cache
      • Image transformation
      • Offload image sub-sizes
    • Configure lightweight 404s for static files
      • Edge Rules overview
      • Edge Rule types
      • Edge Rule conditions
      • Verify Edge Rules
      • Edge Cache preload
      • WooCommerce cart caching
      • Edge Cache
    • Edge request logs
      • DDoS protection
      • Defensive Mode
      • Rate limiting
      • Network and web application firewalls
      • Bot protection
      • Password protection
      • HTTP and security headers
      • PHP filesystem access permissions
      • Scan a site for malware
    • Backups overview
    • Create an on-demand backup
    • Restore a backup
    • Jetpack backups
      • Error logs
      • Web server logs
      • Edge request logs
    • Usage reporting
    • Metrics
    • Application performance monitoring
    • Automated failover
    • IP ranges
    • Origin and edge servers
    • Server specifications and settings
    • EasyEngine integration
    • PanelAlpha integration
      • White labelling and co-marketing WP Cloud
      • WP Cloud logos
      • Terms of Service & Compliance
      • Prohibited content
      • Copyright infringement and takedown notifications
    • WP Cloud billing
    • WP Cloud for agencies and site networks
    • WP Cloud partner support options
    • Troubleshoot Page and Edge Cache
    • Troubleshoot HTTP 429 and 599 errors
    • WP Cloud HTTP status codes
    • Troubleshoot site performance
    • Cache slow database queries
    • Troubleshoot duplicate core files, wp-config.php, and wp-admin 403 errors
    • Troubleshoot email delivery
    • Repair Yoast indexables
    • Troubleshoot PDF thumbnail generation
    • Troubleshoot TLS certificate provisioning

Updates

  • Changelog
  • WP Cloud Status
  • Announcements
Documentation/Performance/Cache/Page Cache

Page Cache

LAST UPDATED

5 months ago

    WP Cloud uses Batcache to store and serve rendered WordPress pages from Memcached. Page Cache reduces repeated PHP and database work at the origin. It is enabled by default on every site.

    Page Cache and Edge Cache are separate layers. Page Cache stores the rendered response at the origin. Edge Cache can serve that response from a location closer to the visitor.

    Default Page Cache behavior

    By default, a page becomes eligible for Page Cache after two origin requests within two minutes. Batcache stores the rendered response for five minutes. Logged-in WordPress sessions and responses that set certain cookies or cache headers may bypass the cache.

    If Edge Cache is enabled, an eligible response can also be stored at the edge. Edge Cache follows the Page Cache lifetime; it does not have a separate page-lifetime setting.

    Clear Page Cache

    Use WP-CLI to clear the WordPress object cache, including Batcache entries:

    wp cache flush

    If plugins or themes interfere with the command, run it without loading them:

    wp --skip-plugins --skip-themes cache flush

    When Edge Cache is enabled, use its management controls when you need to purge edge responses too. Clearing all cached responses sends subsequent requests back to WordPress while the caches repopulate, so prefer a targeted Edge Cache purge when only a few URLs changed.

    Verify Page Cache

    Test while logged out of WordPress. A logged-in session normally bypasses Page Cache and Edge Cache.

    Request the page more than once, then view its HTML source. A response served by Batcache normally ends with a comment similar to this:

    <!--
        generated 2 seconds ago
        generated in 0.180 seconds
        served from batcache in 0.002 seconds
        expires in 298 seconds
    -->Code language: HTML, XML (xml)

    If the comment is absent, inspect the response headers:

    curl -sS -D - -o /dev/null https://example.com/Code language: JavaScript (javascript)

    The following header identifies a Batcache hit:

    x-nananana: Batcache-HitCode language: HTTP (http)

    The HTML comment and x-nananana describe Page Cache. The x-ac header described in Verify Edge Cache describes what happened at the edge. Check both when both cache layers are in use.

    Change the Page Cache lifetime

    Sites can change Batcache settings through the global $batcache value. Add one Batcache configuration block before the /* That's all, stop editing! */ line in wp-config.php. The value may be an object or an array, so account for both forms:

    // Batcache customizations.
    global $batcache;
    
    if ( is_object( $batcache ) ) {
        $batcache->max_age = 86400;
        $batcache->seconds = 0;
        $batcache->times   = 1;
    } elseif ( is_array( $batcache ) ) {
        $batcache['max_age'] = 86400;
        $batcache['seconds'] = 0;
        $batcache['times']   = 1;
    }Code language: PHP (php)

    This example changes:

    • max_age from five minutes to 24 hours.
    • seconds from a two-minute population window to an immediate window.
    • times from two qualifying requests to one.

    Longer cache lifetimes can leave changed content in Page Cache and Edge Cache longer. Confirm that normal content updates invalidate the affected URLs, and clear the relevant cache after changing these values.

    Allow selected cookies without bypassing Page Cache

    Some plugins set a cookie on every response. If that cookie matches a Batcache skip rule, the response is not cached. When the cookie does not change the rendered page, add its prefix to noskip_cookies in the site’s existing Batcache configuration block.

    For example, a site using WPML may need to review these cookie prefixes:

    $ignored_cookie_prefixes = array(
        'wordpress_test_cookie',
        'wp-wpml_current_language',
        'wpml_browser_redirect_test',
    );
    
    if ( is_object( $batcache ) ) {
        $batcache->noskip_cookies = $ignored_cookie_prefixes;
    } elseif ( is_array( $batcache ) ) {
        $batcache['noskip_cookies'] = $ignored_cookie_prefixes;
    }Code language: PHP (php)

    Only ignore a cookie after confirming that visitors with different cookie values can safely receive the same page. Never ignore WordPress authentication, cart, checkout, account, or other cookies that change private or personalized content.

    Bypass Page Cache for selected requests

    Avoid broad Page Cache bypasses. Uncached pages use PHP and database resources on every request and cannot be served by Edge Cache. WooCommerce cart, checkout, and My Account pages are excluded automatically; ordinary product pages remain cacheable.

    Bypass specific paths

    Call batcache_cancel() only for the requests that must not be cached. The following must-use plugin example bypasses two paths:

    <?php
    /**
     * Plugin Name: Site-specific Page Cache bypasses
     */
    
    add_action( 'init', 'site_cancel_page_cache' );
    
    function site_cancel_page_cache() {
        $path = strtok( $_SERVER['REQUEST_URI'], '?' );
    
        if (
            in_array( $path, array( '/uncached-page/', '/another-page/' ), true )
            && function_exists( 'batcache_cancel' )
        ) {
            batcache_cancel();
        }
    }Code language: HTML, XML (xml)

    Replace the example paths with exact paths from the site. After deploying the change, clear any existing Page Cache and Edge Cache entries for those URLs, then verify the result while logged out.

    Troubleshoot Page Cache

    If a logged-out request does not produce a Page Cache hit, use Troubleshoot Page and Edge Cache. It covers cache population, cookies, response headers, explicit bypass functions, and Edge Cache plugin errors.

    Previous WooCommerce cart caching
    Next Edge Cache

    Related Guides

    • Edge Cache preload

      Preload pages into a secondary cache, monitor crawl progress, and verify Edge Cache preload responses…

      4 Min.

      READ

    • WooCommerce cart caching

      Test and manage closed-beta Edge Cache delivery for WooCommerce shoppers with items in their cart.

      3 Min.

      READ

    • Edge Cache

      Partner engineers and support teams can understand, manage, purge, and verify Edge Cache through WP…

      8 Min.

      READ

    On this page

      Contact support

      Contact us with Support issues and questions related to WP Cloud, the WP Cloud Atomic API, API-key IP allow list changes, Station, and more.

      Check the FAQs

      Have questions? Please visit our FAQ to learn more.

      An Automattic venture

      Work With Us

      Press

      Privacy Policy

      © 2021-2026 Automattic Inc.

      Notifications