I need to call in the username of a post's author.
I have tried WordPress: get author info from post id answer code.
I have added the code in the post loop, echoing $display_name
.
It works, but not for what I need, as it displays the nickname.
So I tried changing the 'nickname' to 'username' like:
$post_id = get_the_ID();
$author_id = get_post_field ('post_author', $post_id);
$display_name = get_the_author_meta( 'username' , $author_id );
But it didn't work.