How can I hide and completely disable (in case of bots) the URL and email fields in comments?

There are a few free plugins that seem to do this, but most of them only hide the URL field and not the email field, and anyway for such a small function I think it could just be added to theme functions.php.

Note: I know this prevents Gravatar from working properly.

1 Answer 1


After further research I found some relevant functions. Keep in mind it's probably better to separate these into different functions, and if your WordPress theme gives you any trouble, check this out.

// disable url field
function disable_comment_url($fields) {
    return $fields;

add_filter('comment_form_default_fields', 'disable_comment_url');

// disable email field
function disable_comment_email($fields) {
    return $fields;

add_filter('comment_form_default_fields', 'disable_comment_email');

Also be sure to visit Settings >> Discussion and uncheck the "Comment author must fill name and email" option to avoid user comments being rejected upon submission.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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