<?php
/** fixes values based on term slugs to be numberic by looking up term name **/
add_filter( 'facetwp_index_row', function( $params, $class ) {
$term_id = (int) $params['term_id'];
$value = $params['facet_value'];
if ( 0 < $term_id && in_array( $class->facet['type'], [ 'number_range', 'slider' ] ) && !is_numeric( $value ) ) {
// lookup term name
$term = get_term( $term_id );
if ( !empty( $term ) ) {
$params['facet_value'] = $term->name;
}
}
return $params;
}, 11, 2 );