How to Remove the URL Field in WordPress Comments
One of the greatest ways we’ve found to discourage spammers on our site is to remove the URL field in your WordPress comment section. Thankfully, this is a rather painless process that requires a small plugin or functions.php edit.
Option 1 – Functions.php Edit
Here’s the functions.php code snippet:
// Remove URL Field add_filter('comment_form_default_fields', 't5a_remove_url'); function t5a_remove_url($fields) { if(isset($fields['url'])) unset($fields['url']); return $fields; }
Once you’ve added the following filter to your functions.php, you should notice that the URL field permanently disappears from your commenting area of all posts and pages that allow WordPress comments. This one is really awesome because your website will not even print the URL field in your posts and pages, blocking spambots from even attempting to submit comment spam.
Option 2 – WordPress Plugin
Although we attempt to limit our plugins whenever possible, we do realize that not everyone is comfortable with editing their functions.php or the child themes setup requires should you decide to update your theme to the latest version.
Install the Hide-n-Disable-comment-url-field plugin and you are off to the races.
In your dashboard, go to Plugins > Add New. In the search box, enter Hide-n-Disable-comment-url-field as your search query, then click search. From there, this plugin should be the first plugin in the list.
Install the plugin as usual, activate and you are done.
Time to Verify
To verify the changes are working, visit your WordPress website from a different web browser that is not currently logged in. Navigate to a post that is currently accepting comments and see if you have the website field.