FacetWP – strip commas and other characters from numbers

mgibbs189

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

// Add to your theme’s functions.php, then re-index
function index_raw_number( $params, $class ) {
if ( ‘YOUR_FACET_NAME_HERE’ == $params[‘facet_name’] ) {
$params[‘facet_value’] = preg_replace( “/[^0-9]/”, ”, $params[‘facet_value’] );
$params[‘facet_display_value’] = preg_replace( “/[^0-9]/”, ”, $params[‘facet_display_value’] );
}
return $params;
}
add_filter( ‘facetwp_index_row’, ‘index_raw_number’, 10, 2 );
{{/gist}}