<?php
/** change names formatted "John Smith"
** to display as "Smith, John"
** in facet's index
**/
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( 'personfacet' == $params['facet_name'] ) { // change 'personfacet' to name of your facet
$name = $params['facet_display_value'];
$name = explode( ' ', $name );
$display_name = array_pop( $name ) . ', ' . implode( ' ', $name );
$params['facet_display_value'] = $display_name;
}
return $params;
}, 10, 2 );