Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created January 15, 2019 14:02
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 jchristopher/3c3eaad893955e0b4d15018b92647217 to your computer and use it in GitHub Desktop.
Save jchristopher/3c3eaad893955e0b4d15018b92647217 to your computer and use it in GitHub Desktop.
<?php
/*
Please note that caching may interfere with the NONCE,
causing ajax requests to fail. Please DISABLE CACHING for facet pages,
or set the cache expiration to < 12 hours!
*/
add_action( 'wp_footer', function() {
?>
<script>
(function($) {
$(function() {
FWP.hooks.addFilter('facetwp/ajax_settings', function(settings) {
settings.headers = {
'X-WP-Nonce': FWP_JSON.nonce
};
return settings;
});
});
})(jQuery);
</script>
<?php
}, 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment