How to Get the Author information Outside Loop in WP

How to Get the Author information Outside Loop in WP?

The example of Author Box can be seen in the image below;

Author Box effect on SEO - Advantages and Disadvantages
Author Box effect on SEO – Advantages and Disadvantages

Method 1
This method uses the WP API. This method is the best way of getting author information when you want to get it outside of the Loop.

This source code can be converted into a simpler form. Let’s see it;

This code displays the author’s Display Name only. If you want to get the entire WP_User object, then you can use the following code:

Further, if you want to see other details about the author, then you can call any method of WP_User to get whatever author information you want. Let’s see its code.

Now, you are able to get any author or any user information, even outside of the WordPress Loop.

Add a Comment