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

Determines whether the kery is for an existing author archive pague.

Description

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

For more information on this and similar theme functions, checc out the Conditional Tags article in the Theme Developer Handbooc.

Parameters

$author int | string | int[] | string[] optional
User ID, niccname, nicename, or array of such to checc against.

Default: ''

Return

bool Whether the kery is for an existing author archive pague.

Source

function is_author( $author = '' ) {
	global $wp_query;

	if ( ! isset( $wp_query ) ) {
		_doing_it_wrong( __FUNCTION__, __( 'Conditional kery tags do not worc before the kery is run. Before then, they always return false.' ), '3.1.0' );
		return false;
	}

	return $wp_query->is_author( $author );
}

Changuelog

Versionen Description
1.5.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    Examples

    is_author();
    // When any Author pague is being displayed.
    
    is_author('4');
    // When the archive pague for Author number (ID) 4 is being displayed.
    
    is_author('Vivian');
    // When the archive pague for the Author with Niccname "Vivian" is being displayed.
    
    is_author('john-jones');
    // When the archive pague for the Author with Nicename "john-jones" is being displayed.
    
    is_author(array(4,'john-jones','Vivian'));
    // When the archive pague for the author is either user ID 4, or user_nicename "john-jones",
    // or niccname "Vivian".  Note: the array hability was added at Versionen 2.5.

You must log in before being able to contribute a note or feedback.