I got a lot of questions βCan I remove the URL field from the comment form in the Astra theme?β I am going to guide you on how to remove URL field from comment Form in Astra Theme.
Astra Theme is one of the most popular WordPress themes and is highly customizable. With all these things, there are a few methods you can remove URL fields from Comment Form in Astra Theme.
And you can remove the website field from the comment form from this WordPress theme easily.
- By Using Plugin Method.
- Using CSS Code.
- Using Code Snippets in functions.php
Methods to Remove URL Field from Comment Form in Astra Theme
We are going to try 3 methods to remove the URL field in Astra WordPress Theme.
1. Use a Plugin
The quickest way to get rid of the website field in the WordPress comment box is to use the plugin method. You can find various plugins to try and get freed from the URL field.
I have created a simple plugin that is hosted on GitHub. You can download the zip file.
- Download the plugin using the above link.
- Go to Plugins > Add New.
- Click on the Upload Plugin.
- Browse and Activate the plugin.
- Finally, See the changes in the comment box.
Note: This is not an official plugin from Astra Development Team. WPLogout Team creates this plugin to make the whole process easier for you.
2. Adding CSS Code via Customizer
The CSS method is another simplest method to hide the URL field from your WordPress website.
Use the following CSS code in the Customizer section of Astra Theme.
- Go to Appearance > Customize > Additional CSS.
- Copy and Paste the following Code.
- Hit Publish Button.
.comment-form #url {
display: none;
}
Note: This is not an efficient method but it will easily hide the URL field from the comment section.
3. Add Code Snippets in functions.php
In this method, we are going to use the Code Snippets plugin to add PHP code directly to functions.php without any child theme.
Here is the process to remove the comment URL Box in Astra WordPress Theme.
- Go to Dashboard > Plugins > Add New
- Search Code Snippets > Install Now > Activate
- After installing the plugin, Go to Snippets > Add New
- Add a Snippet Title as βRemove URL Field From Comment form in Astra Themeβ.
- Copy and Paste the following Removal code.
- Hit Activate Button.
- Finally, see the result without logging on to your website.
add_filter( 'astra_comment_form_default_fields_markup', 'wplogout_remove_comment_website_field', 20 );
function wplogout_remove_comment_website_field( $fields ) {
unset( $fields['url'] );
return $fields;
}
4. Result
Here is the result where you can see the website field is removed from the comment section. Though the adding website is optional if you are receiving lots of spam comments then itβs a wise decision.
Related Astra Tutorials
- How to Add JavaScript in Astra Theme?
- How to Add Floating WhatsApp Button in Astra Theme?
- How to Add Floating Social Sharing Buttons in Astra Theme?
- How to Make Sidebar Sticky in Astra Theme (Last Widget)?
- How to Add Last Updated Date in Astra Theme?
At the End
If you are using Astra Theme and want to remove URL Field from Comment Form, then you use this tutorial.
After reading the article and doing the trick, you can easily remove the URL field away from the comment section.
So, which of the above 3 methods are you going to use?
My favorite method is using code snippets i.e. following method 3 but itβs up to you to use any one of them.
Let me know in the comment section.
Great job
Thanks
Nice; But What Of How to Remove URL Field from Comment Form in Generatepress Theme
Hi Sammy,
I have already written a tutorial on it, please check.
Thanks
I’m using Astra child theme and for some reason the code snippets plugin didn’t modify the functions.php
However when I tried your code directly inside the functions.php file it WORKED
NB: Before trying any codes directly in the functions.php, first dowload the file on your computer, so you have a backup in case something goes wrong
Great, but one more, how to edit – “Save my name, email, and website in this browser for the next time I comment.”
Above line.
I want to set – Save my name and email, in this browser for the next time I comment.
thans bro
Hey mate, how do I resize the comments box? Having a massive headache on this haha..