Remove the URL field from comments form

Remove the URL field from comments form

There are situations when the URL (website) field from the comments form is just an unnecessary clutter, for example when your “audience” does not have a personal website.

In cases like this, the best approach would be to remove the field altogether. You can do so by placing the following snippet into functions.php

/**
 * Remove the URL field
 *
 * @param array $fields
 * @return array
 */
 function wcrb_comment_form_default_fields($fields) {
   if (isset($fields['url'])) {
     unset($fields['url']);
   }

   return $fields;
 }

 add_filter('comment_form_default_fields', 'wcrb_comment_form_default_fields');

If you are using a child theme, add the code in the child theme’s functions.php file.

Leave a Reply

Get your fix of
all cool things WordPress

DigitalOcean hosting coupon 10$ coupon

for DigitalOcean hosting.
Sammy-approved.

Get this deal