There are many ways to do this.
Using callback
param
One of methods would be using the callback
param of wp_list_comments
.
This function takes 3 params: $comment
, $args
and $depth
and using it you can create custom HTML code for comments.
There is an example showing how to use this callback in Codex or you can find such callbacks in TwentyX themes.
Using get_comment_author_url
filter
But if you want to modify only the URL for authors, then there’s an easier and cleaner way and I would definitely prefer this solution.
You can use get_comment_author_url
filter as showed below:
function use_author_link_as_comment_author_url( $url, $id, $comment ) {
if ( $comment->user_id ) {
return get_author_posts_url( $comment->user_id );
}
return $url;
}
add_filter( 'get_comment_author_url', 'use_author_link_as_comment_author_url', 10, 3 );