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 need to know how to make one of the fields on my comment not NOT required. How can I set the e-mail field in the comment field to not be required, but optional?

share|improve this question

Settings > Discussion > Other comment settings > uncheck Comment author must fill out name and e-mail


Well, as far as WP is concerned these are glued together. You can add your own check for empty name, something like this (not tested):

add_filter('preprocess_comment', 'require_comment_author');

function require_comment_author($commentdata) {

    if ('' == $commentdata['comment_author'])
        wp_die('Error: please enter a valid name.');

    return $commentdata;

But then will also need to modify form generation so name is marked up as required and email not...

share|improve this answer
Yes, but then how would i require them to fill out that name then? I want to require the name and comment, but not the e-mail address. – user3333 Feb 20 '11 at 15:06

Your Answer


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