Remove URL Field From WordPress Comments Section

Recently, one of our users asked that how to remove URL field from WordPress comments section and why we removed that. We all know, WordPress is the most used and powerful website builder in the world. Due to this, we will get so many attacks and spamming links on our blog. Last day, we have taught you that how can you change your login URL. By removing the URL section from WordPress comments, we can keep our blog safe from spam. This is the main reason that why we removed the URL field from WordPress comments. We clearly mentioned that in our comment policy.

Do you need to remove the URL section from comments on your WordPress blog? This post is for you. You can simply remove the comment section using a plugin or by adding a piece of code to the theme file.

How To Remove URL Field From WordPress Comments Using Code?

We only recommend you coding method for this. All you need to do is, simply edit your WordPress theme’s functions file. But, if you are changing themes everytime, we recommend you to create a site-specific plugin.

So, let’s get started. First of all, login to your WordPress dashboard and go to the theme editor.

wordpress theme editor

Now, select the function file there.

wordpress function file

Before adding the code, let’s check one of our posts.

website url section wordpress

The URL section is there. So, let’s add the code to the functions file.

function tricksflare_disable_comment_url($fields) { 
    unset($fields['url']);
    return $fields;
}
add_filter('comment_form_default_fields','tricksflare_disable_comment_url');

Just copy paste the above code to your theme’s functions file. Don’t forget to save the file then.

remove comment url

After that, you may want to clear your website cache. Now, check any post there. You can see that the URL section got deleted from the comment form.

Remove URL Field From WordPress Comments

This is how you can remove URL field from WordPress comment form. At this time, there are also WordPress plugins to do this. While changing WordPress themes, you will lose this feature. If you are planning to change your WordPress theme every time, we recommend you the plugin method. We hope you enjoyed the post. If you did, please consider sharing our articles with your friends. It will help them to keep their blog free from spam and also us to write more related posts.

Leave a Reply