How to Remove URL Field From WordPress Comment Form

How to Remove URL Field From WordPress Comment Form

WordPress out of the box provides a website link in the comment section which allows the users to mention their website name while dropping a comment on your blog post.

Although its a quite handy feature, it is often targeted by spammers to generate a backlink to their website. Most of the times these spammers put comment and links which are not related to your blog or blog post.

A simple way to prevent these spam comments is to remove the website field from the comment form.

This can be achieved in two ways.

Option #1 Using a WordPress plugin.

If you’re not a Developer I’ll recommend you to use a plugin to disable website links.

Step 1. Install Comment Link Remove and Comment Tools plugin
Step 2. Navigate to “QC CLR Settings” from the sidebar menu.
Step 3. Under “General Settings” check “Remove WEBSITE Field from Comment Form”
Step 4. Hit “Save Changes” button at the bottom of the page.

Option #2 By adding a hook to your functions.php file

To hide the website field from the comments form all you need to do is add the following code to you’re functions.php file.

// Remove comments form link
function hsl_remove_comment_form_link($fields) { 
  unset($fields['url']);
  return $fields;
}
add_filter('comment_form_default_fields','hsl_remove_comment_form_link');

That’s it! I hope you found this post useful. If you’ve any query or feedback feel free to drop a comment.

Must Read: JavaScript Console Tricks

One thought on “How to Remove URL Field From WordPress Comment Form”

Leave a Reply

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