检索作者的链接或作者的姓名。
原型
get_the_author_link()
描述
如果作者设置了主页,则返回HTML链接,否则只返回作者的姓名。
返回值
(string|null)
如果作者的url存在于用户元中,则为HTML链接,否则为结果
源文件
路径:wp-includes/author-template.php
<?php
...
function get_the_author_link() {
if ( get_the_author_meta('url') ) {
return sprintf( '<a href="%1$s" title="%2$s" rel="author external">%3$s</a>',
esc_url( get_the_author_meta('url') ),
/* translators: %s: author's display name */
esc_attr( sprintf( __( 'Visit %s’s website' ), get_the_author() ) ),
get_the_author()
);
} else {
return get_the_author();
}
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_the_author_link/