Make Link to Comment Author Opens in New Window
Feb 18, 2016 7:44 pm No comment
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