InfoPhilic WordPress How to Remove URL / Website Field from WordPress Comment Form?

How to Remove URL / Website Field from WordPress Comment Form?

Engagement is extremely important for any website. In order to set up proper engagement, a direct line of communication should be fostered with care. One way for it is a comment form.

WordPress comes with a built-in comment system that allows for community interaction around your content. Anyone with a valid Name and Email can leave a comment without verifying their identity.

WordPress comment form comes with three fields (name, email, and website or URL). When displaying the comments, WordPress automatically hyperlinks the name of the commenter with the website URL they provided.

It is true that WordPress websites attract a lot of spammers as most of them know how easy it is to build backlinks off from them. Most bloggers do not know how to control spam and they do not have the time to moderate each comment.

Some blackhat SEO guys misuse it and spam your site. And you may be finding ways to stop spam on your website. One of the ways includes removing the URL/Website field from comment form is always beneficial.

SEMrush

If you are a constant target of comment link spam and you have very little time to moderate the comments, then removing the website field entirely will seriously discourage the link spammers.

In this guide, I will tell you two easy ways to remove the URL/website field from the WordPress website.

1. Using comment.php:

  • Go to your theme’s comments.php file.
  • Just remove ‘url’ => field from the code.

Here is the sample code that you have to remove:

$url = '<p class="comment-form-url">' .
'<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" tabindex="3" />' .
'<label for="url">' . __( 'Website', 'genesis' ) . '</label>' .
'</p>';

Note: Every theme has a different code. So make sure you are removing it accordingly. The above code snippet is from the Genesis framework.

2. Using Function.php:

Add the below code to theme’s functions.php file.

// Remove URL/Website field in Comment form
add_filter('comment_form_default_fields','infophilic_remove_comment_url');
  function infophilic_remove_comment_url($fields) { 
    unset($fields['url']);
  return $fields;
}

The code above creates a function called website_remove() and removes (or unsets) the URL field.

Using the Hook add_filter(), we pass the argument to default WordPress function comment_form_default_fields that contain fields of the comment form.

Conclusion:

I hope you find this article useful, and hopefully, this will decrease spam comments on your site. You might also want to read another guide on ‘How to Remove Comment Author URL in WordPress‘.

How do you deal with manually submitted spam comments on your site? Share your opinions in the comment section below.

Amit Malewarhttps://www.infophilic.com/
Amit Malewar has been the tutorial writer since 2013. His passion for helping people in all aspects of technology flow through the expert coverage he provides. In addition to writing for InfoPhilic, Amit loves to read and try new things.

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

GET STARTED

POPULAR NOW

Get almost 100% PageSpeed on Newspaper theme

The newspaper theme is the most popular premium theme for a self-hosted WordPress blog. The theme is developed by team tagDiv. You can buy...

How to Remove jQuery Migrate in WordPress?

Learn how to remove jQuery Migrate from your WordPress site.

How to Delete Multiple Images in WordPress Media Gallery

Hey, guys, today, one of my friends asked me a question, How can I delete Multiple Images in WordPress? I replied, "It's very simple." Yeah,...

WP Super Cache Plugin: Best Settings & Configuration Guide

A cache plugin serves static contents to the visitor, which improves page load speed. There are so many cache plugins available in the WordPress plugin...

How to setup CloudFlare CDN for WordPress blog

In today's world website speed is a crucial element to getting good ranks on the web. Website speed also aids in indexing your site...

DEALS

FREE E-BOOK