This page redirects to an external site: https://developer.wordpress.org/reference/functions/get_author_name/
Returns nickname based on user ID.
<?php $author_name = get_author_name( $user_id ); ?>
Below is an example showing how to display the author's name in archive.php
<?php
if( is_author() ){
/* Store author ID from WordPress query in $user_id */
$user_id = get_query_var( 'author' );
/* Store nickname in $author_name */
$author_name = get_author_name( $user_id );
/* Only echo if $author_name is not null */
if( $author_name !== null )
echo 'Author Archive for ' . $author_name;
}
?>