Automatically replace ampersand “&” with raw &

mgibbs189

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

// Add to your (child) theme’s functions.php
// Make sure to re-index afterwards

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘YOUR_FACET_NAME’ == $params[‘facet_name’] ) {
$params[‘facet_display_value’] = str_replace( ‘&’, ‘&’, $params[‘facet_display_value’] );
$params[‘facet_display_value’] = str_replace( ‘&’, ‘&’, $params[‘facet_display_value’] );
$params[‘facet_display_value’] = str_replace( ‘&’, ‘&’, $params[‘facet_display_value’] );
}
return $params;
}, 10, 2 );

{{/gist}}