wordpress snippets last updated   : July 14, 2014
we now have 634 snippets

Remove / unset URL field from comment form

wordpress snippet

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.

snippet :  PHPcopy
add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
    if(isset($fields['url']))
       unset($fields['url']);
       return $fields;
}
source →
  • GoWebBaby WorDPress Firm

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

    • http://wpsnipp.com Kevin Chard

      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.

      • Shaun Palmer

        // 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;

        }

        }

  • http://twitter.com/shaunpalmernz shaun palmer

    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 ;

    }

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

  • Pingback: How To Remove The URL Field From WordPress Comments - WPMU.org

jqsnipp.com | we just launched jquery snippets website