I’ve implemented this code inside my author.php file, in order to display the username of the author:
<?php printf( "<h4>The blog of<a href='" . get_author_posts_url( get_the_author_meta( 'ID' ) ) . "' title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a></h4>" ); ?>
It displays correctly the username of a user who has posted articles, but unfortunately displays another username when the user hasn’t published anything.
Is there a way to solve that ? Thanks for your help !
Take a look at the codex page on author templates – Author Templates
Especially the
$curauth
object.Quote Source – WordPress Codex / Custom Author Information