Disable The Website URL Field In WordPress Form And Kill Spam

WordPress comes with a default filter comment_form_default_fields that allows you to add remove the default fields in the WordPress comments form. Here’s how to hook into it and kill the website url field. Most spammers are spamming your site because they get the opportunity to put in their website url.

/**
 * Disables the URL field in post comment form
 * @param  [array] $fields Default fields
 * @return [array]         [Modified set of fields]
 */
function myns_disable_comment_url_field( $fields ) {
    unset( $fields['url'] );
    return $fields;
}

add_filter( 'comment_form_default_fields', 'myns_disable_comment_url_field' );
Divi WordPress Theme