facetwp only main query for bb module with facetwp enabled

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/**
** hooks into facetwp_is_main_query to prevent any query except one with bb module facetwp enabled setting
** from being set as main query
**/

add_filter( ‘facetwp_is_main_query’, function( $is_main_query, $query ) {
$settings = $query->get( ‘settings’ );
if ( empty( $settings->facetwp ) || ‘enable’ != $settings->facetwp ) {
$is_main_query = false;
}
return $is_main_query;
}, 10, 2 );
{{/gist}}