2

i have two websites i use Wordpress comments on one website and jetpack comments on another. Both websites shows website column, how do i remove it to save my site from giving unwanted backlinks ?

2
  • Are you talking about the website "field" ? Feb 8, 2019 at 3:50
  • 1
    Yes, because a lot of spammers use that field to obtain backlinks. Feb 8, 2019 at 6:30

4 Answers 4

4

1. Using Plugins to disable Website field from comments

There are many plugins available in the WordPress repository that remove the Website field from the blog comments.

The most easy way is to install Remove Fields or Remove Comment Website/URL Box.

https://wordpress.org/plugins/remove-fields/

2. Editing the WordPress Files to remove the Website field from comments

  • open functions.php file and add code.

add_filter('comment_form_default_fields', 'website_remove');

function website_remove($fields)
{
if(isset($fields['url']))
unset($fields['url']);
return $fields;
}
2
  • 1
    Can i disable it with CSS ? Feb 8, 2019 at 10:43
  • You can hide the field with CSS, but it's still part of the DOM. Using the filter is a better solution (no need for a plugin just for this!) as it remove the field from the DOM rather than just hiding it. Feb 8, 2019 at 10:49
4

I guess you are talking about the website "field". If it is so, add this code in the functions.php file to remove the field:

add_filter('comment_form_default_fields', 'remove_website_field');
function remove_website_field($fields){
    if(isset($fields['url']))
    unset($fields['url']);
    return $fields;
}
2
  • 1
    Is there any other way than this to remove it ? Feb 8, 2019 at 6:17
  • This is the best way to remove the field. You can remove it from the core if you really wanted (don't do that), but this is exactly what filters are meant for. Why do you need another method? Feb 8, 2019 at 10:50
1

Yes, as every other answer has mentioned... definitely the preferred WordPress way would be using the comment_form_default_fields filter.

However, it's very conceivable you might have a situation where you need other solutions. For example, if you're using a default theme and don't want to modify it (because you wouldn't want to lose the changes if the theme gets an update). I've got a site very few plugins/customizations, but it does have an option for custom CSS/JS. I've used both Javascript and CSS solutions.

This CSS hides it from the page (same as mentioned in Vinu's answer )

form.comment-form .comment-form-url {
    display: none;
}

Even better... this JS removes the url field from the page (actually in the weird event there is more than one on a page, this would remove them all):

document.querySelectorAll('.comment-form-url').forEach(child => child.parentNode.removeChild(child));
0

There are 3 easy ways to do it :

SIMPLE AND SHORT: EDITING CSS Go to customize and then custom css/js and add the following code

.comment-form-url{
    display:none;
}

ADD CODE SNIPPET TO FUNCTIONS.PHP

Go to Appearance > Theme editor and click on functions.php

// url field disabler
function remove_url_comments($fields) {
    unset($fields['url']);
    return $fields;
}
add_filter('comment_form_default_fields','remove_url_comments');

USING PLUGINS

Go to Plugins > Add New and search for any one of the following plugin. Remove Fields or Remove Comment Website/URL box or disable-hide-comment-URL.

For a full explanation, you can read my blog here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.