X Features Cars Demo Power Plants Demo State Parks Demo Site Showcase Docs Tutorials Add-ons Buy

Caching

Make FacetWP-powered pages load quicker with page caching.

Installation

Simply activate the plugin. Starting in version 1.5.0, plugin will automatically symlink db.php into the /wp-content/ folder.

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 );

Clearing the cache

When logged in and viewing your front-facing page, you’ll see a FWP menu in the black admin bar.

clearing the cache