facetwp replace display values in index

<?php

/** simple example of replacing values with new values in index
 ** rememember to reindex after adding code
 **/

add_filter( 'facetwp_index_row', function( $params ) {
	if ( 'post_type' == $params['facet_name'] ) { // 'post_type' should be replaced with your facet name
		$current_values = array( 'Posts', 'Products' ); // array of values currently being used that you want to replace
		$replace_values = array( 'Articles', 'For Sale' ); // array of values to replace with, values are in same order as above
		$params['facet_display_value'] = str_replace( $current_values, $replace_values, $params['facet_display_value'] );
	}
	return $params;
});