How to Remove Email and Website Field from WordPress Comment Section

Someone asked me to remove Email and Website field from WordPress comment section, So their reader can easily publish comments without filling these extra fields. You have also seen many sites don’t have website/ URL box in the comment section. Previous we have also written to remove website field.

But Here we are going to also remove email field as well as website field from comment form. This is the easiest way to do this..

How to Remove Email and Website Field from WordPress Comment

Just follow the bellow steps.

- Advertisement -
  • First Login to Your WordPress dashboard.
  • Go to Appearance>Editor
  • And here Found the file name Functions.Php 
  • Open it and go to bottom.
  • Paste the bellow code just before ?>
function remove_comment_fields($fields) {
    unset($fields['email']);
    unset($fields['url']);
    return $fields;
}
add_filter('comment_form_default_fields', 'remove_comment_fields');
  • Now save the file and check your site. (Please remove cache files).

Note: In some WordPress Themes, Code is not working properly. First, try the above one, If this code is not working for you then you can also try this one.

function custom_validate_comment_author() {
    if( empty( $_POST['author'] ) || ( !preg_match( '/[^\s]/', $_POST['author'] ) ) )
        wp_die( __('Error: Please enter your name') );
}
add_action( 'pre_comment_on_post', 'custom_validate_comment_author' );

This code makes comment author field to be required, though in fact comments are anonymous without an email.

Next Thing to Do After Using This Code:

Do not forget this, after using the above codes. By default WordPress enabled 

How you can do this, Just follow bellow steps.

  • Go to Settings>Discussion.
  • Here you see Other comment settings.
Wordpress Discussion Settings
WordPress Discussion Settings
  • Simply uncheck the Comment author must fill out name and email.
  • And in Comment Moderation section , just set the number 1. So when any spammer adds HTML link to the message. it will not be published on your site. And you can manually approve or mark as spam.

We hope this guide help you to Remove Email and Website Field from WordPress Comment section.

Related articles

20+ Essential WordPress Plugins for Bloggers (Updated List)

WordPress is a very popular blogging platform because of...

Easy Ways to Fix & Increase Maximum Execution Time in WordPress

Today, I'm working on new site and installed new...

Best Selling Products

Sale!

15000+ ChatGPT Prompts to Boost Your Business

Original price was: $37.50.Current price is: $1.49.
Sale!

900GB+ Premium Graphics Assets Bundle- All Editable Files

Original price was: $1,260.00.Current price is: $14.85.
Sale!

CorelDRAW 2024- Vector Illustration & Graphic Design Software

Original price was: $810.00.Current price is: $13.49.
Sale!

35000+ Festival & Business PNG Images Biggest Bundle

Original price was: $435.00.Current price is: $45.00.
Abhay Pratap Singh
Abhay Pratap Singhhttps://www.itechcube.com
Abhay Pratap Singh is Digital Entrepreneur, Who is Making Money From the Internet since 2012. He Also Works as a Freelancer and Does Web and Mobile app Development. Apart from That, He Invests in Stock Market and Crypto Currencies. Here in iTechCube, Writes about Blogging, WordPress Guides, and Tutorials to help begginers.

3 COMMENTS

  1. I would like to edit the comment form so that it only asks name, no email, no comment, no url, and also to edit the form so that prompts appear in my language. Do you think that is possible?

  2. I was looking for this only as i need to remove these fields and i am going to remove them now. It was seriously very helpful. Thanx a lot keep sharing such informative articles.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Select your currency
USD United States (US) dollar