FacetWP “preloads” its data on first page load, and stores it in FWP_JSON.preload_data on the page. This data is then used to render the facets almost instantly, without fetching the data with an AJAX call (which happens when using facets).

In some exotic template setups and customized loading sequences, it can be helpful to be able to disable the preloading behavior and instead force an AJAX refresh on first page load. This can be done by adding the following hook to your (child) theme’s functions.php:

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

// Force an AJAX refresh on first page load add_filter( 'facetwp_use_preloader', '__return_false' );

Be aware that this might cause your facets to load slightly slower the first time.

See also

Last updated: August 29, 2024