WordPress: Get Current Author Data

2015-03-20 WordPress

To get current author’s attributes in a template, simply fetch them by using

$author = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));

Now you can access fields such as

$author->first_name

or

$author->display_name