WordPress: Remove URL Field in Comments Section

Srivishnu Ramakrishnan
Srivishnu Ramakrishnan
Engineer & Web Creator
LinkedInTwitter

The URL field in the comments section of the WordPress websites are often used for spamming. One of the ways to mitigate comment spam on your WordPress website is by disabling the URL field.

Here's the code to disable the URL field in WordPress comments section:

php
add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );
function tu_add_comment_url_filter() {
    add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );
}
 
function tu_disable_comment_url($fields) {
    unset($fields['url']);
    return $fields;
}

How to add this code to your WordPress site

How to Add PHP Code to WordPress