Display the author nicknames or other user meta in a facet with Post Author as data source

<?php

// A facet with its data source set to "Post Author" will display the author names as choices.
// To display the author nicknames instead, add the following code to your (child) theme's functions.php and re-index.
// For other author meta info you can get with get_the_author_meta() and index/display instead of nicknames, see: 
// https://developer.wordpress.org/reference/functions/get_the_author_meta/

add_filter( 'facetwp_index_row', function( $params, $class ) {

if ( 'post_author' == $params['facet_name'] ) { // replace 'post_author' with the name of your facet
    $user_id = $params['facet_value'];
    $nickname = get_the_author_meta( 'nickname', $user_id );
    if ( isset( $nickname ) ) {
      $params['facet_display_value'] = $nickname;
    }   
  }

  return $params;
}, 10, 2 );