Have you ever got random spammers and bots to comment on your posts, with their website URL? If yes, then this article is for you. Here I will show you how effectively you can remove URL field from comments in GeneratePress theme.
Thereby, completely preventing automated bots from spamming links on your website.
GeneratePress is a widely used theme in the WordPress eco-space. It is lightweight, has a modular approach with tons of customization options. Therefore, there have been more than 400,000 installations (at the time of writing) until now. If you want to know all the features of this amazing theme, I’d encourage you to read the GeneratePress review.
You can remove website from comments in GeneratePress via;
- WordPress Plugin
- CSS Code
- Code Snippets – GeneratePress “functions.php” file
Why Do You Need To Remove URL Field From Comments In GeneratePress?
The number one reason you’d wanted to remove URL field from comments is to protect your website from spam. According to the comment spam filtering company, Akismet. WordPress gets 487 Billion Spam Messages every month. Akismet controls and prevents 99.9% of spam. But, from our side, we are better off removing website field from the comment form.
Nowadays, spamming is done via automated bots, in order to acquire backlinks from our site. This will spoil your SEO juice within a search engine’s database. In order to get rid of spam, have a powerful spam filtering plugin and also remove URL field from comments in Generatepress theme website.
That will give you peace of mind from spam.
Ways To Remove URL Field From Comments In GeneratePress
The easiest way to do this is by using a plugin. It’s easy for those who find it hard to perform coding on their WordPress websites.
Remove Website Field From Comments Using Plugin
- Within your WordPress Dashboard, look for Plugins, and click on Add New.
- In the Search Bar, type in Remove URL Field from Comment Form in GeneratePress Theme
- Install the plugin and Activate it.
Check any of your blog posts and there shouldn’t be website/URL field in the comments section.
Remove URL Field From Comments In GeneratePress Using CSS
This is another very easy method of removing URL field from comments section.
You can perform this method on GeneratePress free or GeneratePress premium version. All you need is a little bit of CSS code to implement into the GeneratePress theme customizer.
If you want to learn all the differences between both versions of the theme, read GeneratePress free vs premium article.
- Open WordPress Dashboard, go to Appearance, and click on Customize
- Go to Additional CSS
- Paste the following CSS Code and click on Publish
.comment-form #url{
display:none;
}
Now, check a single post on your GeneratePress website.
Just a Two Liner code of CSS and you are done.
The next method is by manually entering code. In GeneratePress, if you want to enter any code into the functions php file. It is suggested to either get a child theme and perform the task on that or simply just install a plugin called Code Snippets.
We are going to install Code Snippets and run the code from it.
Remove URL Field From Comments In GeneratePress Using Code Snippets
For this, you will first need to Install and Activate the Code Snippets plugin.
- Once done, go to your WordPress Dashboard, hover your mouse on Snippets and click on Add New.
- Create a name for the Snippet
- Add the code
- Leave the “Run Snippet Everywhere” selected and let the Priority be at 10
- Click on Save Changes and Activate
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;
}
This is how the comments section of a single blog post should like;
The above method is for those who don’t mind adding some code manually.
Conclusion
In this article, I am wrapping up over here with a feeling that it helps you to remove URL field from comments in GeneratePress theme. You can perform this on GeneratePress free as well as the premium version.
From the three methods mentioned above, I prefer and recommend you to go with installing a plugin or using CSS, if you are not comfortable with coding.
Otherwise, Code Snippets is the best plugin to insert code anywhere within your theme, without any hassles.
Feel free to leave any comments if you have any other ideas for performing this activity. Thank you.
Top comments (0)