How to Disable Facet Auto-Refresh
FacetWP automatically refreshes whenever any interaction happens, but it’s possible to prevent this if needed:
Prevent the auto-refresh
This code goes into your (child) theme’s functions.php
or into a Custom Hooks add-on.
function fwp_disable_auto_refresh() {
?>
<script>
(function($) {
$(function() {
if ('undefined' !== typeof FWP) {
FWP.auto_refresh = false;
}
});
})(fUtil);
</script>
<?php
}
add_action( 'wp_footer', 'fwp_disable_auto_refresh', 100 );
Add an “Apply” button or link to your page
You can add a button to your page to let the user manually apply the facet selections made. You can style the button however you wish. The important part is that the FWP.refresh()
method is triggered on click:
<button onclick="FWP.refresh()">Apply</button>
You can also use a link:
<a href="javascript:;" onclick="FWP.refresh()">Apply</a>