FacetWP – Force a Divi refresh on Blog facet selection

<?php

add_action( 'wp_head', function() {
?>
<script>
(function($) {
  $(document).on('facetwp-refresh', function() {
    if (FWP.loaded) {
      FWP.set_hash();
      window.location.reload();
      return false;
    }
  });
})(jQuery);
</script>
<?php
}, 100 );