FacetWP – distance in DESCENDING order

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

add_filter( ‘facetwp_filtered_post_ids’, function( $post_ids, $class ) {
$params = $class->ajax_params;
$sort_key = empty( $params[‘extras’][‘sort’] ) ? ‘default’ : $params[‘extras’][‘sort’];

if ( ‘distance_desc’ == $sort_key ) {
// @TODO reverse $post_ids
}
return $post_ids;
}, 12, 2 );

{{/gist}}