
Website Field in WordPress Comments tends to be abused by spammers and therefore it is recommended that you remove the website URL field and existing comments links.
Problem: Spam Comments
If you have enabled comments in your WordPress posts, by default, there are four fields that are supposed to be filled by users before they comment. Comment content, name, email, and user website.
If a user comments on your post and fills the website field with his website URL, then the comment name will be linked to the filled URL. The problem with this is that it becomes an avenue for spammers to build backlinks to their websites. You will have hundreds of comments that are not related or add no value to your post. Marking comment links as Nofollow has proved to be an ineffective way of reducing such comments.
Therefore, what you need is to completely remove the option to fill the website URL in the comment form.
Solution: How to remove the website field in WordPress Comments without a plugin
To remove the website URL field from WordPress comments without a plugin, add the following PHP code to your theme’s functions.php file.
// Remove website field from comments
add_filter(‘comment_form_default_fields’, ‘blogies_remove_website_field’);
function blogies_remove_website_field($fields)
{
if(isset($fields[‘url’]))
unset($fields[‘url’]);
return $fields;
}
The above code will remove links for new comments. Therefore, use the code below to remove website links from existing comments.
//Remove existing author comment links
function blogies_remove_comment_links( $url, $id, $commentr ) {
return “”;
}
add_filter( ‘get_comment_author_url’, ‘blogies_remove_comment_links’, 10, 3);
NOTE: Use both codes if you have existing comments with links.
Related: Best comment form plugins and software.
Leave a Reply