How To Remove The URL Field From WordPress Comments
There are some WordPress sites where you may not want to include the URL field in the comment form. It’s not always necessary and spammers tend to use it to link to their spammy websites, which will be posted in your comments if you have auto-approval turned on. Just to be safe, you may want to remove that URL field altogether.
Here’s a quick snippet I found the other day while browsing WPSNIPP.com. You can add the code below to your theme’s functions.php file or create a quick functionality plugin for it – your choice.
FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.
FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.
add_filter('comment_form_default_fields', 'unset_url_field'); function unset_url_field($fields){ if(isset($fields['url'])) unset($fields['url']); return $fields; }
Pretty simple, right? Use this same formula for removing any of the other comment fields from the form. This is assuming that you’re using the default WordPress comment form. If you’re using a plugin, there may be an even easier way to remove that field within the form building settings.
photo credit: photobunny via photopin cc
Tags: