How to get author’s name by author’s id

Try get_user_by():

get_user_by( $field, $value );

In your case, you’d pass ID, and the user ID:

// Get user object
$recent_author = get_user_by( 'ID', $recent["post_author"] );
// Get user display name
$author_display_name = $recent_author->display_name;

Leave a Comment

error code: 523