How to open comments in new window in WordPress

As I stated in mine post Should Comments open in same window or different windows , I asked you to open your comments in new window. Here I am telling you how to do this. WordPress by default open the comments in same window.

WordPress by default open the comments in same window. But opening the comments urls in your blogs own tab deviates the user from your website and you are left with losing the time that he/she might have spent on your blog and might have clicked on more of your posts.

You need not to worry if you get very less comments or your comments mainly contains no link to the commentator website because in that case the changes will only affect the minor time the visitor spends on your blog. But in case you receive huge number of comments, I recommend following the below tutorial:

WordPress Code changes for Opening Comments in new Tab

To force your site to open external comments in new tab, follow the below steps:

1. Login to your ftp account.

2. Go to your_site\public_html\wp-includes

3. Download the file comment-template.php

4. Search for function ‘get_comment_author_link’

5. Go the line– $return = “<a href=’$url’ rel=’external nofollow’ class=’url’>$author</a>”;

6. Place target=’_blank’ after <a . Don’t forget to give a space <a

7. The line looks now–  $return = “<a target=’_blank’ href=’$url’ rel=’external nofollow’ class=’url’>$author</a>”;

8. Upload the file .

9. ftp will ask to Overwrite the file. Click Yes.

10. Now, open your blog.

11. The comments now will open in new browser tab.

NOTE: Back-up file comment-template.php before making any changes to it.

Leave a Comment

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