WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to remove the email field in the comment form. It works for url but not for email : the email field is still there. Do you know why?

function url_filtered($fields)
  if(isset($fields['url'])) {
  return $fields;
add_filter('comment_form_default_fields', 'url_filtered');


share|improve this question
up vote 2 down vote accepted

This works fine for me:

add_filter('comment_form_default_fields', 'wpse53687_filter_fields');
 * Unsets the email field from the comment form.
function wpse53687_filter_fields($fields)
    return $fields;

One reason that it could be failing on your theme is that args were passed into comment_form. Specifically, the theme author passed in a fields key into the $args.

As the filter name (comment_form_default_fields) implies, the fields are only defaults.

Fortunately there is another filter! comment_form_field_{$name}. Just hook in and return false and it should get rid of the email field.

add_filter('comment_form_field_email', '__return_false');
share|improve this answer
Thanks! it works perfectly! so is there any way to directly edit the code in the form? (without using these filters?) – Paul May 30 '12 at 8:42
No, not really. The comment_form is usually what gets used in themes. – chrisguitarguy May 30 '12 at 16:06
ok thanks Christopher – Paul May 30 '12 at 16:46

try this:

add_filter('comment_form_default_fields', 'remove_email');
function remove_email($val) {
    $val['email'] = '';
    return $val;    
share|improve this answer
thanks t-p for the answer – Paul May 30 '12 at 8:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.