WPKube

How to Remove the Website Field From the Comment Form

Last month, I made a lot of small improvements here at WP Kube and one of them was removing website field from the comment form.

Ever since I started the blog, I was getting a bunch of spam comments (and most of those were human spammers who were just commenting for backlinks).

I tried Livefyre & Disqus but didn’t liked it.

I always loved the default commenting system and there’s no way I could use another commenting system. So I decided to enhance the functionality of default WordPress commenting system.

By default the WordPress comment form has the website field and there is no simple way to disable it.

To remove the website field from the comment form, paste the below code into your functions.php file.


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

For Genesis Users

If you’re using Genesis theme then paste the below code in your functions.php file (the functions.php file can be found in your child theme)


add_filter( 'genesis_comment_form_args', 'url_filtered' );
add_filter( 'comment_form_default_fields', 'url_filtered' );
function url_filtered( $fields ) {

if ( isset( $fields['url'] ) )
unset( $fields['url'] );

if ( isset( $fields['fields']['url'] ) )
unset( $fields['fields']['url'] );

return $fields;
}

For Thesis Users

Thesis has built their own commenting system, so the best way to remove the field would be editing the thesis core files or using a css to hide the website field.

To hide the website field with css, please paste the below code in your custom.css file


.custom #commentform input[name="url"],  .custom #commentform label[for="url"] { display:none; }

That’s it. I hope that this tutorial has helped you in removing the website field from the comment form.