How to Remove Website URL Field from WordPress Comment Form?

Website owners remove website fields from the WordPress comment form to prevent automated bots and unauthorized users from posting spam links on their WordPress website. This practice helps in retaining the SEO Juice of the website.

There are two options with which you can remove the website field from the WordPress comment form –

1. Using ‘comment_form_default_fields’ Filter

php
/**
 * Remove Website Field From Comment Form
 *
 * @param array $fields
 * @return array $fields
 */
function maverick_remove_comment_website_field($fields)
{
    if (isset($fields['url']))
        unset($fields['url']);
    return $fields;
}
add_filter('comment_form_default_fields', 'maverick_remove_comment_website_field');

2. Using ‘comment_form_field_url’ Filter

php
/**
 * Remove Website Field From Comment Form
 */
add_filter('comment_form_field_url', '__return_false');

Leave a Reply

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