→ Caching

Make FacetWP-powered pages load quicker with page caching.

Installation

These installation steps must be followed exactly!
  • Install and activate the plugin
  • Does /wp-content/db.php exist?
    • No: copy facetwp-cache/db.php into /wp-content/db.php
    • Yes: copy the code from facetwp-cache/db.php to the top of /wp-content/db.php

Setting the expiration

By default, the cache will expire after 1 hour (3600 seconds). You can adjust the expiration with the following filter:

function my_cache_lifetime( $seconds ) {
    return 86400; // one day
}
add_filter( 'facetwp_cache_lifetime', 'my_cache_lifetime' );

Page-specific expiration

You can also set custom expirations for specific pages:

function my_cache_lifetime( $seconds, $params ) {
    if ( 'products' == $params['uri'] ) { // http://website.com/products/
        $seconds = 1800;
    }
    return $seconds;
}
add_filter( 'facetwp_cache_lifetime', 'my_cache_lifetime', 10, 2 );

Changelog

1.3.2

  • Added second parameter to facetwp_cache_lifetime filter

1.3

  • Automatic updates!
  • IMPORTANT: before upgrading, please delete the older version

1.2.2

  • Support direct access: FWP_Cache()->cleanup()

Details

  • Version: 1.3.2
  • Updated: Jul 7, 2016

Get Started

Download now