Created
June 25, 2019 16:46
-
-
Save mgibbs189/33a7f318bf914e06cd1a89ed1a105839 to your computer and use it in GitHub Desktop.
FacetWP - automatically support taxonomy terms containing numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment