确定查询是否针对现有作者归档页面。
原型
is_author( mixed $author = '' )
描述
如果指定了$ author参数,则此函数将另外检查查询是否针对指定的作者之一。
参数
$author
(mixed)
(Optional)
用户ID,昵称,nicename或用户ID,昵称和nicenames数组
返回值
(bool)
源文件
路径:wp-includes/query.php
<?php
...
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 );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/is_author/