Remove link to comment authors website from wordpress Comments

Are you tired of moderating, removing or editing the URLs of people who post comments in your wordpress blog? Are you sick of all the comment spammers who post those cookie cutter comments using scripts in your blog just to post links in your blog via the comment links to comment authors site? Well I was! And that’s when I decided that I would hack the wordpress code a little bit to totally disable linking to commenter’s site from the comments posted in the blog.

The link to commenter’s site does serve some good purposes like letting the comment poster link to his/her blog/site which might have good resources and also allows free publicity and exchange of traffic between genuine blogs and sites via the comment links, but there is way too much nuisance and problems which weigh down these advantages.

Well this is what you need to do if you want to remove these links. Go to the wp-includes directory in your wordpress installation via ftp, locate a file called comment-template.php (in older versions of wordpress you would need to find comment-functions.php) , download the file, create a backup of the file to make sure you can upload a working copy in case you mess up.

Open the php file with notepad (any text editor) or any code editing software you may have. Now in the file at around line 106 you would locate a function called get_comment_author_link() (around line 347 if you are editing comment-functions.php) . The line number might vary from wordpress versions, but the code within the function is the same for all versions of wordpress after 1.5, so this hack will work for all versions of wordpress 1.5 and up. Within the function you would see the following lines

$url = get_comment_author_url();
$author = get_comment_author();
if ( empty( $url ) || ‘http://’ == $url )
 $return = $author;
 $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
return apply_filters(‘get_comment_author_link’, $return);

What this function does is, check if the comment author posted a URL when he/she posted a comment, if there is no url it just prints the author name, if there is an URL with the comment then wordpress prints the author’s name as a link to the author’s website. We are going to modify the function to just print the author’s name (without a link) even if a URL is present with the comment. For that just replace

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


$return = $author;

And you are done! Just save the file, upload the file back into the server and you should get comments with links removed with just the author’s name throughout the website!


You can leave a response, or trackback from your own site.

7 Responses to “Remove link to comment authors website from wordpress Comments”

  1. blackhat proxies says:

    Can you tell us more about this? I’d love to find out more details.

  2. Milton Babin says:

    Hello.This post was extremely remarkable, particularly since I was browsing for thoughts on this issue last Thursday.

  3. Gambio GX Optimierung says:

    My brother suggested I might like this website. He was once entirely right. This put up actually made my day. You can not imagine just how so much time I had spent for this information! Thank you!

  4. warp_net_site says:

    Nice post…

    I am often to blogging and i really appreciate your content. The article has really peaks my interest. I am going to bookmark your site and keep checking for new information….

  5. Gabriela says:

    Hi! I’m at work surfing around your blog from my new iphone 3gs! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the outstanding work!

  6. singapore tuition tutor agency says:

    This article is genuinely a good one it assists new
    web users, who are wishing for blogging.

  7. join us says:

    very informative post.i appreciate your work.thanks for this informative post.

Leave a Reply

Designed for Ares Galaxy in Collaboration with Hostgator coupons and Popular Wordpress Themes and unlock iphone 5