comment_author_link()WP 0.71

Display the html link to the url of the author of the current comment.

No Hooks.

Return

null. Nothing (null).

Usage

comment_author_link( $comment_id );
$comment_id(int|WP_Comment)
WP_Comment or the ID of the comment for which to print the author's link.
Default: current comment

Examples

0

#1 Display the name of the current commenter as a link to his page:

This will print author’s link with anchor tag.

<?php echo comment_author_link(); ?>

Output will:

<a href="https://example.com" rel="external nofollow" class="url">Author Name</a>

Use comment_author_url(), if you want to get only comment author’s url.

Changelog

Since 0.71 Introduced.
Since 4.4.0 Added the ability for $comment_id to also accept a WP_Comment object.

comment_author_link() code WP 6.7.1

function comment_author_link( $comment_id = 0 ) {
	echo get_comment_author_link( $comment_id );
}