How to get post author name in WordPress?

Rakhi Prajapati picture Rakhi Prajapati · Mar 18, 2017 · Viewed 38.2k times · Source

In WordPress I need to fetch name of author who created post using author_id.
How can I find author_name ?

Answer

Raunak Gupta picture Raunak Gupta · Mar 18, 2017

You can use get_the_author_meta(), to get author data.

echo get_the_author_meta('display_name', $author_id);

Hope this helps!