Remove website field from wordpress comment form

As website URL field is not mandatory in wordpress comment form but many times spammer use it to get backlinks to their website that results tons of garbage and spam comment. To get rid of spammer simply remove website field from comment form.

To remove website field edit functions.php file in your WordPress theme folder and add following code

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

Above code will stop working after theme change or update. To remove website field permanently we can make WordPress plugin with above code.

Create a new file (eg: remove-website-field.php) in your WordPress plugin directory and add following code

<?php
/*
Plugin Name: Remove Website Field
Plugin URI:  https://99webtools.com/blog/remove-website-field-from-wordpress-comment-form/
Description: Plugin to removes website field from WordPress comment
Version:     1.0
Author:      Sunny Verma
Author URI:  http://99webtools.com
License:     GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
function remove_comment_website_url($fields) { 
    unset($fields['url']);
    return $fields;
}
add_filter('comment_form_default_fields','remove_comment_website_url');
?>

After adding above file in your WordPress plugin folder activate this plugin. To activate it login to WordPress admin dashboard and go to plugin section and click active link.

wordpress plugin

Published by Sunny

A Mechanical engineer by education and web developer by passion and profession. He lives in Lucknow, India. Currently earning his livings by hitting keyboad. ;)

Leave a comment

Your email address will not be published. Required fields are marked *