WordPress: Remove URL Field in Comments Section

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:

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;
}
PHP

How to add this code to your WordPress site

Leave a Comment