检索指向当前帖子作者的作者页面的HTML链接。
原型
get_the_author_posts_link()
描述
使用get_author_posts_url()返回HTML格式的链接。
返回值
(string)
指向作者页面的HTML链接。
源文件
路径:wp-includes/author-template.php
<?php
...
function get_the_author_posts_link() {
global $authordata;
if ( ! is_object( $authordata ) ) {
return;
}
$link = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
/* translators: %s: author's display name */
esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
get_the_author()
);
/**
* Filters the link to the author page of the author of the current post.
*
* @since 2.9.0
*
* @param string $link HTML link.
*/
return apply_filters( 'the_author_posts_link', $link );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_the_author_posts_link/