Make Link to Comment Author Opens in New Window

Just open and edit your comment-template.php inside the wp-includes folder. Search the file’s source code until you find the function get_comment_author_link as below;

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

	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, $author, $comment->comment_ID );
}

Now you only need to add target='_blank' inside the link tag, of the second $return variable;

$return = "<a href='$url' rel='external nofollow' target='_blank'>$author</a>";

Save the file and upload it to the wp-includes folder.

Categories: Tutorials

 

 

Please Leave a Reply

If you don't have anything nice to say, pretty please don't go on and ruin my day. I'd appreciate your kindness very much. Thank you :)