FacetWP – different cache depending on whether the user is an admin

mgibbs189

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

add_action( ‘wp_head’, function() {
$role = current_user_can( ‘manage_options’ ) ? ‘is-admin’ : ‘non-admin’;
?>
<script>
(function($) {
$(document).on(‘facetwp-refresh’, function() {
FWP.extras.role = ‘<?php echo $role; ?>’; // cache buster
});
})(jQuery);
</script>
<?php
}, 100 );
{{/gist}}