How to Remove Comment Author Website Link in WordPress

Share This Article:

WordPress comment form includes “Website” field, where comment author can add a link to his/her own website. It is a great feature that helps to get back-links and traffic easily. But this option is often misused  by spammers to promote their blog or product through spam comments.

remove-comment-author-link-wordpress

Some anti-spam plugins like Akismet can be used, but in some cases those spam comments will by-pass these plugins. It is not always possible to moderate all those comments, hence here is a simple solution for that.

Read This : How to Disable or Limit Post Revisions in WordPress

Remove Comment Author Website Link in WordPress

You need to edit this file in your theme folder…

functions.php

Hence it is advised to backup your theme.

Deactivate comment author links, by using the code below. Go to Appearance > Editor, add this code to functions.php and update file.

/** Removes link to comment author website */
function author_link(){
global $comment;
$comment_ID = $comment->user_id;
$author = get_comment_author( $comment_ID );
$url = get_comment_author_url( $comment_ID );
if ( empty( $url ) || 'http://' == $url )
$return = $author;
else
$return = "$author";
return $return;
}
add_filter('get_comment_author_link', 'author_link');

Functionality of this Code:

  • We have tweaked Default WordPress filter which adds link to comment author website.
  • If there is no input in website field, then name of the author will be displayed.
  • If any website link is included along with the comment, then also only author name will be displayed.

This is the best method and works fine on many WordPress themes including Genesis.

Read This : How to Login to WordPress using Email Address

Alternate Method to Remove Comment Author Website Link

You need to edit this file in your theme folder…

comments.php

Hence it is advised to backup your theme.

Follow these steps :

  • Go to Appearance > Editor and edit comments.php file.
  • Now Search for comment_author_link() code in it.
  • Replace comment_author_link() with comment_author() and update file.
  • Voila, you have successfully removed author website link from comments.

Hope you like this code and if you got any query regarding this article please do post a comment. We are glad to help you and don’t forgot to subscribe to our feeds.

Genesis is the most flexible WordPress theme framework that comes with tons of options. We have been using Genesis on all of our blogs and recommending the same to you. Every bit of it is coded according to the standards. Give it a try!

Comments

  1. Raaj Trambadia says:

    Nice tutorial and very useful, only for a rare amount of people :) To be honest, one would hardly receive any comments if there’s website field. That field is a must, but just doesn’t have a ‘required’ label next to it :)

    • WPSquare says:

      Agree with you, but this trick is for those who don’t want more comments for their blog posts…

  2. dlysen says:

    Its nice to know that kind of options. Its very interesting “most of the tutorials I found here” giving privileged to add link is more fun. I agree with Raaj. And just like magicians, more tricks more fun too.

  3. burhan says:

    thanks

  4. Jeet says:

    thanks. really worthy…

Speak Your MindComments Policy →

*

Looking for More Awesomeness?

Read previous post:
disable-limit-post-revisions-wordpress
How to Disable or Limit Post Revisions in WordPress

WordPress creates revisions to posts and pages which are automatically saved it the database. Any small change made to a...

Close