Skip to content

How to Use get_the_author_meta in WordPress to Show Author Info

Your author’s are the heart of most WordPress sites. They write your content, engage with your audience, and generally make the site work as it should. As such, you’ll often want to get WP author meta from the site so that you can show it off in your template. The way to get meta author tag information from WordPress is a handy function called get_the_author_meta (or, if you don’t need to do any processing, the_author_meta). Using this function is a great way to get the author meta fields from your WordPress users, and show those author fields in your WordPress theme templates.

Scroll down to learn more about how to use the function get_the_author_meta and gain new insight on its nuances.

3 Common Issues to Know about get_the_author_meta and WP Author Meta

  • get_author_name was previously a way that WordPress offered to get a chosen author’s display name. Now, the best way to do that is get_the_author_meta('display_name').
  • To show (or display, echo, or print—you pick your word) your author information without otherwise processing it in PHP, you’ll want to use the_author_meta(), the WordPress function that will default to showing the selected author fields. It is functionally equivalent to calling echo get_the_author_meta.
  • get_the_author is a useful WordPress function to find the author of the current post. get_the_author_meta and get_the_author function collect the same data about the same user (when no WordPress user ID is specified). While it’s not deprecated, like get_author_name above, it’s functionally the same as get_the_author_meta('display_name').

Our Video About Using get_the_author_meta for WordPress Author Bios:

In this video, David uses the get_the_author_meta functions to fetch the description or “Biographical Info” meta field from his WordPress user—essentially get the author bio. The video doesn’t use get_the_author or get_author_name, but as we noted above, you could do those with get_the_author_meta('display_name').

Step-by-Step Guide to Showing WordPress User Meta with the_author_meta

Here, we break down the three steps to make the meta author tag visible.

  1. First, you’ll want to do this inside of WordPress template files. Generally, this will mean that you’ll be editing a file in your WordPress child theme. Here’s our Quick Guide on making a child theme.
  2. Once in that file, you’ll probably want to be inside of “The Loop”, although the get_the_author_meta functions can work either inside or outside the loop. Inside, you’ll get to show the user email with the_author_meta( 'user_email' ); outside, it would look like: the_author_meta( 'user_email', 111 ) (where 111 was this user’s $userid)/
  3. That’s all! Because it’s what we showed off in the video, the user’s flexible “Biography” field is fetched with get_the_user_meta( 'description' ) and then made to have paragraph breaks with the wpautop function. So, the final line of code was echo wpautop( get_the_user_meta( 'description' ));. (wpautop is a WordPress function which makes two line breaks into a paragraph-tag of HTML markup.)

With that, you should have a very solid understanding of how to show your WordPress author metadata and meta author bio using functions. the_author_meta and get_the_author_meta are powerful functions—it’s well worth your time to understand them in depth. Cheers!

Yay! 🎉 You made it to the end of the article!
David Hayes
Share:

0 Comments
Inline Feedbacks
View all comments

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!