Open Comment Author Link In New Window

Here’s the PHP code you can simply copy from the view raw link and paste at the end of your child themes functions.php file to open comment author links in a new window.

Clearly, if you’ve removed the comment authors website URL field this code will not work.

The get_comment_author_link filter is located in the WordPress core wp-includes/comment-template.php file:

function get_comment_author_link( $comment_ID = 0 ) {
	$url    = get_comment_author_url( $comment_ID );
	$author = get_comment_author( $comment_ID );

	if ( empty( $url ) || 'http://' == $url )
		$return = $author;
	else
		$return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";

	return apply_filters( 'get_comment_author_link', $return );
}

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.