Pages Menu
Categories Menu

Posted by on Jul 10, 2013 in Blog, Tips & Tricks | 4 comments

Removing the URL field from the WordPress comments form

Removing the URL field from the WordPress comments form

WordPress started as just a blogging platform in 2003 and is now used as a content management system to host millions of websites around the world.

By default WordPress allows the user to leave a web address when they post a comment. It’s this web address many spammers use to create inbound links to their websites.

By adding a few lines of code this can be prevented.

  1. Login to the WordPress dashboard
  2. Choose appearance > Editor
  3. Open functions.php and paste the code below at the end of the file.


function remove_comment_fields($fields) {
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields','remove_comment_fields');

Now the Url field won’t be displayed (see below)

Wordpress comments form with URL field removed

WordPress comments form with URL field removed

../back

4 Comments

  1. Amazing blog! Is your theme custom made or did you download it
    from somewhere? A design like yours with a few simple
    tweeks would really make my blog shine. Please let me know where you got your design.

    • The name of the theme is Trim and it’s from a company called Elegant Themes. They charge a yearly fee for the themes but if your a small company developing multiple sites its a great resource.

  2. Oh it’s really easy:) I was thinking that i need a plugin to do that. Thank’s!

    • Thanks Mikrodermabrazja. I’m glad to help.

Post a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>