WordPress is_author() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Conditional tag

Definition

In WordPress, is_author() returns true on an author archive, the page that lists all posts written by one user. A typical URL is /author/jane/.

Call it with no argument to match every author page. Pass an ID, a nickname, or a nicename to match one author.

Syntax

Use it as the test of an if statement.

WordPress
if ( is_author() ) {
  // code for the true path
} else {
  // code for the false path
}
CallWhat it does
is_author()True on any author archive.
is_author( 4 )True on the archive of the user with ID 4.
is_author( array( 'jane', 'john' ) )True on the archive of any author in the list.

This tag is for the author archive. For a single post by one author, check get_the_author() in the loop.

Full declaration
WordPress
is_author( int|string|int[]|string[] $author = '' ): bool

Parameters

ParameterDescription
$authorOptional. A user ID, nickname, nicename, or an array of them. Default is empty, which means any author.

Return Value

Return ValueDescription
booltrue if the main query is for an author archive, otherwise false.

WordPress Examples

Three short theme examples. Each one shows what prints on the true path and the false path.

Example 1 — Show an author heading

Print the author name on every author archive.

WordPress
<?php if ( is_author() ) {
  echo '<h1>Posts by ' . esc_html( get_the_author_meta( 'display_name', get_query_var( 'author' ) ) ) . '</h1>';
} ?>

How It Works

  1. is_author() is true on an author archive.
  2. get_query_var( 'author' ) gives the author ID.
  3. esc_html() keeps the name safe.

Example 2 — One author only

Add a short bio box for a single author.

WordPress
<?php if ( is_author( 'jane' ) ) {
  echo '<p class="bio">Jane writes about WordPress themes.</p>';
} ?>

How It Works

  1. The argument 'jane' is the author nicename.
  2. The tag is true only for that author archive.
  3. Other author pages skip the block.

Example 3 — Check a list of authors

Use an array to match more than one author.

WordPress
<?php if ( is_author( array( 2, 5, 9 ) ) ) {
  echo 'Staff author page';
} ?>

How It Works

  1. The array holds three user IDs.
  2. The tag is true if the current author is in the list.
  3. You can mix IDs and nicenames.

Frequently Asked Questions

It returns true or false (a bool). Use it inside an if statement.
No. It is true only on the author archive. Use get_the_author() inside the loop for a single post.
It accepts a user ID, a nickname, or a nicename (the slug in the URL).
WordPress may show a 404 for an author with no published posts, so the tag will not be true.
Conditional tags need the main query. Call them in template files or on hooks such as wp or template_redirect, not directly at the top of functions.php.

Next: is_category()

Check if the current page is a category archive.

is_category() tutorial →

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.

11 people found this page helpful