How to get the Author Object outside “The Loop” in WordPress

I needed to get the Author Username (or ‘user_login’ parameter in the WordPress code) in the header for a project.  Other times I’ve seen this done is by using the get_author() function, but that requires being in “The Loop“.  I found a post that explained how to do it by first getting the post ID, then from that the post author ID, and finally the user login using the author meta function.

First, we get post_id object because it contains post_author attribute, which contains the author’s ID:


Then retrieve the author’s ID:


Finally, using the author’s user ID we can get any of the other parameters associated with that author.  In this case the ‘user_login’:

For a full list of Author Meta Parameters click here