How to Modify get_comment_author_link to Open Comment Authors Website on new Window

wordpress-logo-notext-rgbBy default, get_comment_author_link  redirects the user to the site which was entered by comment author when they wrote comment in same window of our site. What if we want this to open on new window?

Add following code to functions.php in your live theme directory

//Display website on new window when readers click Commenter's name 
add_filter( "get_comment_author_link", "pxzoom_modifiy_comment_author_anchor" );
function pxzoom_modifiy_comment_author_anchor( $author_link ){
    return str_replace( "<a", "<a target='_blank'", $author_link );
}

Comments

2 responses to “How to Modify get_comment_author_link to Open Comment Authors Website on new Window”

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: