How to remove URL field in GeneratePress comment form

GeneratePress theme is loved by many bloggers out there because of its blazing fast speed, simplicity and customization. We as a blogger can achieve almost anything with a GeneratePress theme. If you do not use the GeneratePress theme, I personally suggest you to get the GeneratePress theme because you are already missing something as a blogger.

GeneratePress theme by default has a “Website” field in its comment form. That means any of your readers can put up their website link when they leave a comment on your post.

If you want to remove the ‘URL’ field or let’s say ‘Website’ field from the GeneratePress theme’s comment form then you are at the right place.

Before proceeding to the tutorial let’s first know why to remove the default URL field from the GeneratePress comment form.

Why remove the URL field from the Generatepress comment box?

Many nasty bloggers and spammers look for sites that have a URL field in the comment box and when they find it, they spam the comment section with spam comments for link building.

I often used to get tons of such spam comments. So, I decided to remove the URL field from the GeneratePress theme.

How to remove the URL field from comment box in GeneratePress theme?

Today in this post we will discuss three ways to remove the URL field from the comment box. We can use a plugin or add a custom CSS or add a small code in functions.php to remove the URL field from the comment box in the GeneratePress theme.

P.S: All the three different methods discussed below will work on the free and premium versions of the GeneratePress theme.

So, let’s get started.

Using a plugin

If you are not that techy or do not want to mess up your website by adding codes or CSS to your website then this method is for you.

You have to install this simple plugin called URL Field Remover For GeneratePress and it will do the magic for you. Having any second thoughts about using this plugin? Do not worry, this plugin is developed by me for my own site.

  • First download the plugin from here.
  • From your WordPress dashboard go to Plugins >> Add new >> Upload >> Install.

After uploading and installing the plugin you have successfully removed the URL field from your comment box (comment form) in the GeneratePress theme. It’s that easy. 

You don’t have to do anything further.

Adding CSS code

If you do not want to use a plugin then you can use a simple CSS code to your GeneratePress powered WordPress website.

  • From the WordPress dashboard go to Apperance >> Customize >> Additional CSS.
  • In the additional CSS field add the following CSS.
.comment-form #url{
	display:none;
}

Adding custom CSS from customization.
Fig: Adding custom CSS from customization.
  • Now, click Publish.

After this, you have successfully removed the URL field from your comment form.

Adding code to functions.php

In this method, you need to copy and paste the below code to your functions.php file.

I suggest you to do all the theme editing in your child theme because if you mess anything up your website may go down.

add_action( 'after_setup_theme', 'wptracer_add_comment_url_filter' );
function wptracer_add_comment_url_filter() {
    add_filter( 'comment_form_default_fields', 'wptracer_disable_comment_url', 20 );
}

function wptracer_disable_comment_url($fields) {
    unset($fields['url']);
    return $fields;
}

  • Copy the above code
  • From your WordPress dashboard go to Appearance >> Theme Editor >> Functions.php
  • In the functions.php file add the above code just after <?php
Adding code to functions.php file.
Adding code to functions.php file.
  • After adding the code click update.

After adding the code your ‘website’ field from the comment form will be removed.

Fig: URL field removed in the comment form in GeneratePress theme.

In conclusion, we tried three different methods to remove the URL form field from the comment form in the GeneratePress theme. 

I personally suggest you to use the plugin method or the CSS method as adding code to functions.php might break down your site if you mess it up.

If you have any queries regarding this tutorial feel free to comment down below.

More From GeneratePress.

Leave a Comment