Skip the first and use the second detected query if a facetwp-enabled query is running twice for some reason

<?php
// Tells FacetWP to skip the first detected query and use the second.
// Can be useful if for some reason a facetwp-enabled is running twice on a page, 
// which will cause a query detection issue and non-functioning facets or pagination.

add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
    if ( 0 === strpos( FWP()->helper->get_uri(), 'special-project' ) ) {
        global $fwp_runonce;
        if ( $is_main_query && !isset($fwp_runonce) ) {
            $is_main_query = false;
            $fwp_runonce = true;
        }
    }
    return $is_main_query;

}, 10, 2 );