How to remove the URL field from a WordPress website comments field to stop spam comments

How to remove the website URL field from WordPress comments without a plugin

30-second read.

If you’re fed up because you’re receiving a ton of spam comments from people trying to get backlinks by posting fake comments and their website’s URL/address in your WordPress blog comments “website” field option and you don’t want to install a plugin to remove the field entirely, add the following code to your functions.php file (preferably in your child theme if you have one)

Note:- The code immediately below is also worth trying if you’ve already searched and tried PHP code that you’ve found elsewhere that didn’t work (see “Footnote” further down the page):

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) {
    return $fields;

After this, go to Settings > Discussion and uncheck the: “Comment author must fill out name and email field”.

You must uncheck the required field in your WordPress settings

This should act as a deterrent as there will no longer be anywhere to visibly insert a website address to get the desired backlink.


You may have reached this page because the below code didn’t work for you. However, this still works for a lot of people so it’s also worth a try if you’re not having much luck!

add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
       return $fields;