Home › Forums › Front End PM PRO › Disable › Reply To: Disable
October 30, 2020 at 12:29 am
#41587
jilllynndesign
Participant
Found the solution! FacetWP includes this documentation:
Pass authentication data through REST API requests:
https://facetwp.com/pass-authentication-data-through-rest-api-requests/
I needed to add the following code and now things work as they should:
/*
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 );