apply_filters( 'get_comment_author_link', string $return, string $author, int $comment_ID )

Filters the comment author’s link for display.


Description Description


Parameters Parameters

$return

(string) The HTML-formatted comment author link. Empty for an invalid URL.

$author

(string) The comment author's username.

$comment_ID

(int) The comment ID.


Top ↑

Source Source

File: wp-includes/comment-template.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
4.1.0 The $author and $comment_ID parameters were added.
1.5.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Samuel Elh

    Link to author posts archive page:

    /**
      * To link to bbPress/BuddyPress profile or also link
      * avatar, see http://blog.samelh.com/?s=comment+author
      */
    
    add_filter('get_comment_author_link', 'se_link_comment_to_archives');
    function se_link_comment_to_archives( $link ) {
        global $comment;
        if ( !empty( $comment->user_id ) && !empty( get_userdata( $comment->user_id )->ID ) ) {
       		$link = sprintf(
       			'<a href="%s" rel="external nofollow" class="url">%s</a>',
       			get_author_posts_url( $comment->user_id ),
       			strip_tags( $link )
       		);
        }
        return $link;
    }

    It should work as long as the comment was submitted by a verified and logged-in user on your blog.

You must log in before being able to contribute a note or feedback.