<?php

// Added to the Custom Hooks plugin
add_action( 'wp_footer', function() {
?>
<script>
(function($) {
  $(document).on('facetwp-refresh', function() {
    if (FWP.loaded) {
      FWP.set_hash();
      window.location.reload();
    }
  });
})(jQuery);
</script>
<?php
}, 100 );