WordPress Author

Beginner
5 min read
Updated: Nov 2026
2 examples
Template tags

Definition

WordPress author template tags are PHP functions that show facts about the person who wrote a post. You can print the name, link to the author archive, show the bio, or count the posts.

Print the name with the_author(). Get it as a string with get_the_author(). Read any profile field with the_author_meta(). List every author with wp_list_authors().

Where to use them.

Add these tags to theme files such as single.php, archive.php, and author.php. Most of them work inside The Loop.

Syntax

A typical byline in a theme file:

WordPress
<?php while ( have_posts() ) : the_post(); ?>
  <p>
    By <?php the_author(); ?>
    <?php the_author_posts_link(); ?>
  </p>
<?php endwhile; ?>

get_* vs the_*

Many author tags come in pairs. Pick the one that fits your job.

StyleWhat it doesExample
the_*Prints the value to the page.the_author()
get_*Returns the value so you can store, test, or escape it.get_the_author()
Link to the author siteUses the website from the author profile.get_the_author_link()
Link to the author archiveUses a URL on your own site.the_author_posts_link()

Function Groups at a Glance

Pick a group, then open the guide you need.

GroupTypical jobStart here
Display nameShow the author name or a profile field.the_author(), get_the_author(), the_author_meta()
Links & URLsLink to the archive or to the author website.the_author_posts_link(), get_author_posts_url(), the_author_link()
Counts & listsCount posts or list all authors.the_author_posts(), wp_list_authors()
Admin helpersBuild a user select box.wp_dropdown_users()

WordPress Examples

Two short theme examples with sample output.

Example 1 — Byline in a post

Print the author name and a link to all of their posts.

WordPress
<?php while ( have_posts() ) : the_post(); ?>
  <h2><?php the_title(); ?></h2>
  <p>
    Written by <?php the_author(); ?>
    (<?php the_author_posts_link(); ?>)
  </p>
<?php endwhile; ?>

How It Works

  1. the_author() prints the display name.
  2. the_author_posts_link() prints a link to the author archive.
  3. Both tags run inside The Loop, so they know which post you are showing.

Example 2 — get_ and the_ together

Store the name with get_the_author(), then print it safely.

WordPress
<?php
$name  = get_the_author();
$posts = get_the_author_posts();
?>
<p>
  <?php echo esc_html( $name ); ?> has written
  <?php echo (int) $posts; ?> posts.
</p>

How It Works

  1. get_the_author() returns the name, so you can store it in $name.
  2. esc_html() keeps the output safe before it is printed.
  3. get_the_author_posts() returns the post count as a number.

Next: WordPress Author Functions Index

After you know the basics, open the functions index for all ten guides.

Full list: WordPress Author Functions index (/wordpress/author/function).

Frequently Asked Questions

They are small PHP functions that show information about the person who wrote a post. Examples are the author name, a link to the author archive, the bio, and the post count. You call them in theme files like single.php and author.php.
Use the_* when you just want to print something, for example the_author(). Use get_* when you want to keep the value in a variable, check it with if, or escape it, for example get_the_author().
Most author tags read the author of the current post, so call them inside The Loop. On an author archive page you can also pass a user ID, for example the_author_meta( 'display_name', get_queried_object_id() ).
get_the_author_link() links to the website the author typed in their profile. the_author_posts_link() links to the author archive on your own site, which lists all of their posts.
Open the WordPress Author Functions index. It lists all ten guides in simple tables with short descriptions.

Browse every author function

Open the functions index for simple guides with examples and FAQs.

Author Functions Index →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful