WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/the author

Description

The author of a post can be displayed by using this Template Tag. This tag must be used within The Loop.

To return to PHP rather than displaying, use get_the_author().

Attention: unike other template tags like the_title(), the_author() not only displays but also returns the value, so be sure to use <?php the_author() ?> but not <?= the_author() ?> to avoid double output.

Usage

 <?php the_author(); ?> 

Examples

Display Author's 'Public' Name

Displays the value in the user's Display name publicly as field.

<p>This post was written by <?php the_author(); ?></p>

Parameters

$post-id (integer).

Related

the_author(), get_the_author(), get_the_author_id(), the_author_link(), get_the_author_link(), the_author_meta(), get_the_author_meta(), the_author_posts(), get_the_author_posts(), the_author_posts_link(), get_author_posts_url(), get_the_modified_author(), the_modified_author(), wp_dropdown_users(), wp_list_authors()

See also index of Function Reference and index of Template Tags.