Drop this code into your theme’s functions.php
file to remove both ‘website’ and ’email’ field from WordPress’ comment form:
function remove_website_email_field($fields) { $fields = array( $fields['author']); //add $fields['email'] for only website field return $fields; } add_filter( 'comment_form_default_fields', remove_website_email_field );
Removing ’email’ field will only work if you have “Comment author must fill out name and e-mail” option disabled on Discussion Settings page.
Or, you can also create a plugin to do this. Create a new file with .PHP extension in wp-content/plugins/ with this code:
<?php function remove_website_email_field( $fields ){ if(isset($fields['url'], $fields['email'])) //remove $fields['email'] for only website field unset($fields['url'], $fields['email']); //remove $fields['email'] for only website field return $fields; } add_filter( 'comment_form_default_fields', 'remove_website_email_field' ); ?>
Plugin would be handy if you are using a theme that receives regular updates. This also gives you the option of easily disabling the feature from your dashboard.
One thought on “Remove Website and Email Fields from WordPress Comment form”
How to remove website form only