jenny-r
12/12/2017 - 6:53 PM

facetwp change author display - co-authors

facetwp change author display

<?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( 'login', $params['facet_display_value'] );
        if ( false !== $user ) {
            $params['facet_display_value'] = $user->last_name . ', ' . $user->first_name
        }
    }
    return $params;
}, 10, 2 );