Gists

4 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 );
2 years ago
<?php

// add to your (child) theme's functions.php
// this unregisters the proximity facet's "post ID re-sorting" hook

add_filter( 'facetwp_query_args', function( $query_args ) {
    remove_filter( 'facetwp_filtered_post_ids', [ FWP()->helper->facet_types['proximity'], 'sort_by_distance' ] );
    return $query_args;
} );