1

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?

1

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

Update

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...

  • 1
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy