Support » Fixing WordPress » Remove 'url' and 'email' fields from comments form

  • Resolved WolfpackFan


    Hi all,

    I am trying to get rid of the ‘url’ and the ’email’ fields that appear when a user goes to submit a comment. The things I’ve tried from googling around a bit do not seem to work.

    My understanding is that within the comments.php I need to pass some kind of customized array to the comments_form() method but the wordpress documentation for customizing this array is highly confusing (at least to me).

    I would appreciate any help with exact code I need to put into my comments.php to remove those two fields.

    I’m not sure if it really matters for my situation but for full disclosure I’m running the ‘Simple Catch’ version 2.2 theme on WP 3.5.1.

Viewing 8 replies - 1 through 8 (of 8 total)
  • function remove_comment_fields($fields) {
        return $fields;
    add_filter('comment_form_default_fields', 'remove_comment_fields');

    Try to add this code into the theme’s functions.php

    Thread Starter WolfpackFan


    Hi vjpo, thank you for your quick response.

    I have cut and pasted the code you provided into my functions.php file. I added it to the bottom of the file however those two fields are still appearing on my site.

    Hi, WolfpackFan.
    Ok, the theme uses it’s own function for altering comment form.
    So try to change lines 907 in simple-catch/functions/simplecatch_functions.php to
    $fields['url'] = '';

    The same possible for email field but this field is required in WP by default (I didn’t think about it in beginning). In this case you must uncheck the “Comment author must fill out name and e-mail” in “discussion” WP options to give people possibility to leave comments. After that comment form will have only one required field – the comment text.

    If you want to make “name” field to be required, you have to google about right way how to do it 🙂

    As an option, you can simplify commenting by add possibility to comment from social networks accounts, as it provides Jetpack and number of other plugins.

    Thread Starter WolfpackFan


    vjpo, you are the man! (or woman if you happen to be!)

    Thanks very much.. that indeed removed the two fields! Guess my theme I was running did matter 🙂

    Thread Starter WolfpackFan


    I can go ahead and mark this thread as resolved too

    Yep, the man 😀
    Just for interest, I found code that makes comment author field to be required, though in fact comments are anonymous without an email.

    function custom_validate_comment_author() {
        if( empty( $_POST['author'] ) || ( !preg_match( '/[^\s]/', $_POST['author'] ) ) )
            wp_die( __('Error: Please enter your name') );
    add_action( 'pre_comment_on_post', 'custom_validate_comment_author' );

    Thanks vjpo! I’m using kirumo and was not finding the code in the “usual” spots. This did the trick!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Remove 'url' and 'email' fields from comments form’ is closed to new replies.