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.

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.1.1

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