Pressable
We have seen several users in our support having issues with FacetWP with their sites hosted on Pressable. These issues are caused by caching features that are enabled by default.
Pressable uses several layers of caching. Two of these caching types appear to be problematic on pages with facets: the “Batcache” page cache, and the (persistent) object cache.
Fix issues with Batcache static page cache
Pressable’s Batcache is a static page cache that stores generated HTML for pages in memory using Memcache.
To fix issues with FacetWP, you can exclude your facet pages from the Batcache by installing the Pressable Cache Management Plugin. After activating it, go to the Object Cache tab and enter the facet page(s) in the “Exclude Page from Batcache” setting.
Alternatively, you can use a mu-plugin to do this.
Fix issues with Pressable persistent object caching
By default the WordPress object cache is non-persistent. This means that data stored in the object cache resides in memory only and only for the duration of the request. However, Pressable’s object cache uses Memcache to store database queries in the object cache persistently across page loads to speed up your site.
Persistent object caching in general is problematic with FacetWP. It interferes with FacetWP’s ability to detect or use the right query on refresh. This leads to a range of possible issues like post listings not refreshing or filtering, facets not loading, unexpected posts showing, pagination issues, wrong post and/or result counts, or the “FacetWP was unable to auto-detect the post listing” error.
To fix this, add the following code to your (child) theme’s functions.php. The code flushes the object cache each time that the facet pages you’ve indicated are visited, which should allow FacetWP to work normally.
Note that in line 3 you need to provide the URI(s) of the page(s). The URI is the part of the URL without the domain name and the query variables, without beginning and ending slashes.
How to use custom PHP code?
PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info
add_action( 'facetwp_init', function(){ $uri = FWP()->helper->get_uri(); $facetpages = [ 'my-page', 'my-page/sub-page' ]; // Add the URI of one or more facet pages. The URI is the part of the URL without the domain name and the query variables, without beginning and ending slashes. if ( in_array( $uri, $facetpages ) ) { wp_cache_flush(); // Flush the object cache } });
Note that we have not tested it ourselves. Please let us know if it does not work.