Remove website field in comment form – WordPress
The website field in comment form in blogs and CMS help comment authors to make a link towards there website / blog. This is a normal practice to increase traffic towards there website / blog. It help us and them because the number of valuable comments in our article is now consider as a measure of quality of content.
If the comments are valuable for that content and readers, there is a chance to get referral traffic towards the comment authors website / blog. But spammers always utilize this facility to make pure back linking to there website / blog using keywords in comments.
Any way we can easily remove website field in WordPress comment form if it is not necessary.
- First we want to open child theme’s function.php file.*
-
Copy and paste below code snippet to child theme’s function.php file.
add_filter('comment_form_default_fields', 'url_filtered'); function url_filtered($fields) { if(isset($fields['url'])) unset($fields['url']); return $fields; }
- Save file, logout from administration panel and check weather website field is available in post comment form.
Remarks
*Before starting, you need a WordPress child theme and necessary files for it. I already write a post about how we can create a child theme for WordPress in simple steps.
Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!
Recent Posts
- Automating Code Linting with GitHub Actions for WordPress Plugins
- Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer
- The Ultimate Guide to Indexing in Database Design
- Understanding 'update_meta_cache' in WordPress - When to Use It, When Not to, and Its Impact on Database Queries
- A Guide to Configuring JavaScript and SCSS Paths in WordPress Plugins with @wordpress/scripts
Your Questions / Comments
If you found this article interesting, found errors, or just want to discuss about it, please get in touch.