facetwp change author display

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
// re-index your facets after adding this code
add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘author’ == $params[‘facet_name’] ) {
$user = get_user_by( ‘id’, $params[‘facet_value’] );
if ( false !== $user ) {
$params[‘facet_display_value’] = $user->last_name . ‘, ‘ . $user->first_name
}
}
return $params;
}, 10, 2 );
{{/gist}}