≡ Menu

[How-To Guide] Open Comments In New Window In WordPress

Already, I have shared a how to guide on avoiding spam comment using .htaccess method and now in this post I’m sharing a how to guide on opening comment in new window in WordPress. By default, WordPress comment open in same window and the visitor who click on comment author’s link will taken off from the site. This is bit annoying to me so, I find a way to get the link open in new window. Here is a step-by-step guide on opening comment in new window:

Step1: Log-in into cPanel (URL mentioned below) and click on “File Manager” as shown below:

http://www.domainname.com/cpanel (replace domainname with your domain)

comments-new-window+wordpress+how-to+how-to-guide-on-opening-comments-new-window

Step2: When you click on “File Manager” it open a new window, i.e. root directory. Now select “wp-includes” folder as shown below:

comments-new-window+wordpress+open-comment-new-window-wordpress

Step3: In “wp-includes folder” select “comment-template.php” file (as shown below) and click on “Edit” option in navigation menu.

comments-new-window+wordpress+comment-template.php+edit

Step4: Now in “comment-template.php” file search for the function “get_comment_auhtor_link” (as shown below). After finding the function “get_comment_author_link” search for the line as mentioned below:

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

comments-new-window+comment-window+wordpress

Step5: Now replace the function (in step4) with the function as mentioned below and click on “Save Changes” button as shown below:

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

comments-new-window4

Step6: Congratulations, you have successfully changed the comment-template.php file and now the comments will open in new browser tab.

Remember

Back-Up file comment-template.php before making any changes in it.

Do you have any question, then ask in comment section or you can use Free WordPress Installation Service. Don’t forget to like on Facebook so that you don’t miss any update on WordPress Tutorial

Find this post useful, then share it with your friends and don’t forget to tweet it.

{ 2 comments… add one }
  • Bligbook

    Great article……probably this could increase my page views and decrease bounce rate…

Leave a Comment