<?php
/** for when some entries are using & and some just & to standardize to keep
** facet from ending up with 2 facet_values that cause the same label to display in 2 choices
** generally happens with custom fields not taxonomies
** could be used for other encoded characters
**/
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( strpos( $params['facet_display_value'], '&' ) > 0 ) {
$params['facet_display_value'] = str_replace( '&', '&', $params['facet_display_value'] ); // make & standard
$params['facet_value'] = str_replace( '&', '', $params['facet_display_value'] ); // remove & to prevent md5 hash
}
return $params;
}, 10, 2 );