X

Remove / unset URL field from comment form

Removing the URL field from your comments form is a simple snippet just add this code to the functions.php of your wordpress theme to remove the URL / website field.


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

Comments  Leave a Reply

  1. Gave me the white screen of death.

    1. This is more likely an issue with the functions.php file rather than the snippet. I would check the functions.php file to make sure,

  2. How To Remove The URL Field From WordPress Comments - WPMU.org March 26, 2013 at 5:17 pm

    […] a quick snippet I found the other day while browsing WPSNIPP.com. You can add the code below to your theme’s functions.php file or create a quick […]

  3. try it like this but not working if(have_some_suggestion){
    for_functions{
    ID);

    function unset_url_field($page_id ){

    if(isset($page_id [‘url’]))

    unset($page_id [‘url’]);

    return $page_id ;

    }

    }
    ————————————————————————–*/–>
    }
    }

  4. GoWebBaby WorDPress Firm August 17, 2012 at 7:40 am

    Why to remove url field from the comment form, it encourage commenter to comment instead of it better to assign no follow link attribute.

    1. This snippet is more for people that are working on a theme, removing the field could be used for product reviews or if they created a support tickets theme that does not require a url field.

      1. // I just want to unset from comment form the Home page

        add_filter(‘comment_form_default_fields’, ‘unset_url_field’);

        if($fields = is_home() || is_front_page() {

        function unset_url_field($fields){

        if(isset($fields[‘url’]))

        unset($fields[‘url’]);

        return $fields;

        }

        }

Add a Comment Cancel reply

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!