Gists

2 years ago
<?php

// Add to your (child) theme's functions.php

add_filter( 'facetwp_filtered_post_ids', function( $post_ids ) {
    $facets = FWP()->facet->facets;
    if ( isset( $facets['keywords'] ) && ! empty( $facets['keywords']['selected_values'] ) ) {
        remove_filter( 'facetwp_filtered_post_ids', [ FWP()->helper->facet_types['proximity'], 'sort_by_distance' ] );
    }
    return $post_ids;
}, 9 );