FacetWP – automatically support taxonomy terms containing numbers

mgibbs189

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

// Add the following to your (child) theme’s functions.php and re-index afterwards

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
$term_id = (int) $params[‘term_id’];
$display_value = $params[‘facet_display_value’];

// If this is a taxonomy term and the display value is numeric,
// Then set facet_value = facet_display_value
if ( 0 < $term_id && is_numeric( $display_value ) ) {
$params[‘facet_value’] = $display_value;
}

return $params;
}, 10, 2 );

{{/gist}}