检索当前注释的作者的url的HTML链接。
原型
get_comment_author_url_link( string $linktext = '', string $before = '', string $after = '', int|WP_Comment $comment )
描述
$ linktext参数仅在评论作者不存在URL时使用。如果URL确实存在,那么将使用URL并忽略$ linktext。
参数
$linktext
(string)
(Optional)
要显示的文本而不是评论作者的电子邮件地址。
$before
(string)
(Optional)
要在电子邮件链接之前显示的文本或HTML。
$after
(string)
(Optional)
电子邮件链接后显示的文本或HTML。
$comment
(int|WP_Comment)
(Optional)
注释ID或WP_Comment对象。默认是当前评论。
返回值
(string)
$ before和$ after参数之间的HTML链接。
源文件
路径:wp-includes/comment-template.php
<?php
...
function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) {
$url = get_comment_author_url( $comment );
$display = ($linktext != '') ? $linktext : $url;
$display = str_replace( 'http://www.', '', $display );
$display = str_replace( 'http://', '', $display );
if ( '/' == substr($display, -1) ) {
$display = substr($display, 0, -1);
}
$return = "$before<a href='$url' rel='external'>$display</a>$after";
/**
* Filters the comment author's returned URL link.
*
* @since 1.5.0
*
* @param string $return The HTML-formatted comment author URL link.
*/
return apply_filters( 'get_comment_author_url_link', $return );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_comment_author_url_link/