Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Created October 23, 2020 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgibbs189/3a50530f778c91b29d72de0b32a0e065 to your computer and use it in GitHub Desktop.
Save mgibbs189/3a50530f778c91b29d72de0b32a0e065 to your computer and use it in GitHub Desktop.
FacetWP - ignore URL hash except when resetting
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
if (! FWP.loaded) {
FWP.temp_set_hash = FWP.set_hash; // on init, save a backup of FWP.set_hash()
}
if (FWP.is_reset) {
FWP.set_hash = FWP.temp_set_hash; // on reset, store FWP.set_hash()
}
else {
FWP.set_hash = function() { /* empty */ } // otherwise, empty it
}
});
})(jQuery);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment