<?php
// Filters out the "FacetWP has not detected a listing template" on pages without a '.facetwp-template' element.
// This is useful in niche customized scenarios where FacetWP JS assets are loaded on all pages, e.g. if included in a code compilation pipeline.
add_action('wp_footer', function() {
?>
<script>
const originalConsoleError = console.error;
console.error = function() {
if (arguments[0] &&
typeof arguments[0] === 'string' &&
arguments[0].includes('FacetWP has not detected')) {
return;
}
originalConsoleError.apply(console, arguments);
};
</script>
<?php
});