On this page
is_author( int|string|int[]|string[] $author = '' ): bool
Determines whether the query is for an existing author archive page.
Description
If the $author parameter is specified, this function will additionally check if the query is for one of the authors specified.
For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.
Parameters
$authorint|string|int[]|string[] Optional-
User ID, nickname, nicename, or array of such to check against.
Default:
''
Return
bool Whether the query is for an existing author archive page.
Source
File: wp-includes/query.php. View all references
function is_author( $author = '' ) {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_author( $author );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Query::is_author() wp-includes/class-wp-query.php | Is the query for an existing author archive page? |
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| _doing_it_wrong() wp-includes/functions.php | Marks something as being incorrectly called. |
Used By
| Used By | Description |
|---|---|
| rest_get_queried_resource_route() wp-includes/rest-api.php | Gets the REST route for the currently queried object. |
| wp_get_document_title() wp-includes/general-template.php | Returns document title for the current page. |
| get_the_archive_description() wp-includes/general-template.php | Retrieves the description for an author, post type, or term archive. |
| get_the_archive_title() wp-includes/general-template.php | Retrieves the archive title based on the queried object. |
| feed_links_extra() wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| wp_title() wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| WP::handle_404() wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| wp_dropdown_users() wp-includes/user.php | Creates dropdown HTML content of users. |
| get_body_class() wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| redirect_canonical() wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/is_author