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');
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; }
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.
It’s that time of year again when people start revving up their shopping lists, hunting…
Trying to figure out how to start an online course so that you can share…
An affiliate program can be a great way to get more sales if you're selling…
Considering using LearnDash to create online course content with WordPress? LearnDash is a popular WordPress…
WordPress XML files see a lot of use for me as a content creator, and…
If you’re looking for a way to deliver an online course, complete with all the…
View Comments
Excellent. Thanks Devesh!
Thanks for the comment, Brad.
Hi Devesh, Have you found that this has been an effective way of getting rid of spammers? This change would be good for those who just want links back to their sites. Could you just make your blog a no-follow blog instead?
Also, this would prevent CommentLuv from being used which is a great way of encouraging commenters. I'm wondering if you have found that you have fewer commenters as well as fewer spammers.
Thanks for sharing this!
Hey Carolyn,
I know this is not the most effective way of getting rid of spammers, but I think it depends on what type of site you're running. I can make this blog a no-follow instead but that won't stop spammers to leaving comments.
I still get a lot of spam comments but far less then what I was getting a few months ago.
Yeah, I do know this blog gets fewer commenters as well as fewer spammers but I am not really after comments. I think having fewer quality comments is much better then having 10+ low quality comments (that are there just for backlinks & traffic).
Thanks for sharing your insights, Carolyn. I appreciate your great support.
Hi Dev,
Great insights (I read even the comments too).
But how would you find someone who makes thoughtful comments on your blog?
Maybe he can track them via the email address. But that would be a helluva lot of extra work to get a conversation on a topic.
Thanks, Devesh. Worked like a charm on a Genesis Theme (Focus). Appreciate you sharing this very much.
I have the need to remove all three fields. and leave only the big field (field description).
is it possible?
...about Genesis Theme...
/** dcdcdcdcdcdc Rimuovere la funzione Info messaggio */
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;
}
/** dcdcdcdc Rimuovere la funzione Info messaggio */
add_filter( 'genesis_comment_form_args', 'email_filtered' );
add_filter( 'comment_form_default_fields', 'email_filtered' );
function email_filtered( $fields ) {
if ( isset( $fields['email'] ) )
unset( $fields['email'] );
if ( isset( $fields['fields']['email'] ) )
unset( $fields['fields']['email'] );
return $fields;
}
/** dcdc Rimuovere la funzione Info messaggio */
add_filter( 'genesis_comment_form_args', 'name_filtered' );
add_filter( 'comment_form_default_fields', 'name_filtered' );
function name_filtered( $fields ) {
if ( isset( $fields['name'] ) )
unset( $fields['name'] );
if ( isset( $fields['fields']['name'] ) )
unset( $fields['fields']['name'] );
return $fields;
}
I tried this code to remove the 'email' option from the comments form:
/** dcdcdcdc Rimuovere la funzione Info messaggio */
add_filter( ‘genesis_comment_form_args’, ‘email_filtered’ );
add_filter( ‘comment_form_default_fields’, ‘email_filtered’ );
function email_filtered( $fields ) {
if ( isset( $fields['email'] ) )
unset( $fields['email'] );
if ( isset( $fields['fields']['email'] ) )
unset( $fields['fields']['email'] );
return $fields;
}
But it did nothing. Any other suggestions?
Hi Dave,
I just visited your site and it looks like you were able to remove the website field.
Hi Devesh,
Yeah, it did remove the website field. Thanks for the post. I know it is off topic, but some also asked for the removal of: [website] option in the comments. And I was hoping someone had the code for that too for Genesis.
thnx for the blogpost
(btw: your website speed is very slow)
Hi Dave,
I'll look into it and see if I can get something for removing the email id.
Regarding the speed, is it still loading slow?
thnx!
Yes speed is much better now! Big difference!
I'm using the Generate child theme in Genesis and this worked fine for me. The code snippets provided by StudioPress didn't work - so thanks a bunch for posting this!
Glad I could able to help you, Dean. Thanks for stopping by.
Amazing resource, thank you for spending your time and effort in putting this list. I will be happy to share this post..
Great, I tried the first on my blog and it worked..
Thumbs Up Dev.
Thank you so much. I added your code to the end of functions.php just as you instructed and it work beautifully!
Glad I could able to help you, Mounir. Thanks for the comment.
Is it possible to selectively remove a comment field (say a custom field) 'only' from the comment-reply form?
for example my main comment form has a website/location field, but I don't want to ask people who reply to an existing thread to have to fill in that extra information.