How To Remove The URL Field From WordPress Comments

Cut the URL field out of the WordPress comment form

There are some WordPress sites where you may not want to include the URL field in the comment form. It’s not always necessary and spammers tend to use it to link to their spammy websites, which will be posted in your comments if you have auto approval turned on. Just to be safe, you may want to remove that URL field altogether.

Here’s 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 functionality plugin for it – your choice.

{code type=php}
add_filter(‘comment_form_default_fields’, ‘unset_url_field’);
function unset_url_field($fields){
if(isset($fields[‘url’]))
unset($fields[‘url’]);
return $fields;
}
{/code}

Pretty simple, right? Use this same formula for removing any of the other comment fields from the form. This is assuming that you’re using the default WordPress comment form. If you’re using a plugin, there may be an even easier way to remove that field within the form building settings.

photo credit: photobunny via photopin cc