Pass the current post ID to FacetWP

mgibbs189

{{gist file=”test.php” lang=”php”}}
<?php

// See https://facetwp.com/how-to-use-hooks/
add_action( ‘wp_head’, function() {
?>
<script>
(function($) {
$(document).on(‘facetwp-refresh’, function() {
FWP_HTTP.post_id = ‘<?php echo $post->ID; ?>’;
});
})(jQuery);
</script>
<?php
}, 100 );

// To access it (within your Query Arguments box)
$post_id = (int) $this->http_params[‘post_id’];

{{/gist}}