is_author

Definition:
function is_author( $author = '' ) {}

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

Parameters

  • mixed $author: Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames

Source code

	function is_author( $author = '' ) {

		if ( !$this->is_author )

			return false;



		if ( empty($author) )

			return true;



		$author_obj = $this->get_queried_object();



		$author = (array) $author;



		if ( in_array( $author_obj->ID, $author ) )

			return true;

		elseif ( in_array( $author_obj->nickname, $author ) )

			return true;

		elseif ( in_array( $author_obj->user_nicename, $author ) )

			return true;



		return false;

	}

2093

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: