is_author

Is the query for an existing author archive page?.

Description

is_author( (string) $author = '' ); 

If the $author parameter is specified, this function will additionally check if the query is for one of the authors specified.

Parameters (1)

0. $author — Optional. (string) => ''
User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames

Usage

  1. if ( !function_exists( 'is_author' ) ) { 
  2. require_once ABSPATH . WPINC . '/query.php'; 
  3.  
  4. // Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames 
  5. $author = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = is_author($author); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/query.php  
  1. function is_author( $author = '' ) { 
  2. global $wp_query; 
  3.  
  4. if ( ! isset( $wp_query ) ) { 
  5. _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); 
  6. return false; 
  7.  
  8. return $wp_query->is_author( $author );