Do you want to remove the URL field from your WordPress comment form? And wanted to prevent automated bots from posting spam links on your website? Then you came at the right place.
There are a number of ways to remove URL field from WordPress comment form and here we have posted 4 methods to remove the URL field from Comment Form.
So let’s start without wasting time.
Remove URL Field With Plugin – Method 1
If you are not a developer and have no knowledge of PHP, you should try the disable-hide-comment-url plugin.
Steps to use Disable URL field Plugin.
- Download and install disable-hide-comment-url plugin.
- Activate and check that the URL field is removed or not from the front end.
- Done!
Remove URL Field with Comment Field function – Method 2
Remove URL text from WordPress comment form with just simple code snippets. What we have done in the following code is that we have removed the URL field and have the remaining name field and email field.
Steps to Use Remove URL functions.
- Open your theme’s functions.php or if you are using child theme, then open of your’s child theme’s functions.php
- Copy the below code.
- Paste it into your file functions.php.
- Save and check your website.
- Done!
function modify_comment_form_fields($fields){ $fields = array( 'author' => '<p class="comment-form-author"><label for="author">' . __( 'Name', 'text-domain' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'text-domain' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>', ); return $fields; } add_filter('comment_form_default_fields','modify_comment_form_fields');
Remove URL Field Function – Method 3
Below is the code snippets that you can use for removing URL field from Comment Box. No matter which theme you use, it works on any WordPress Theme.
Steps to Use Remove URL function.
- Open your theme’s functions.php or if you are using child theme, then open of your’s child theme’s functions.php
- Copy the below code.
- Paste it.
- Save and check your website.
- Done!
Remove URL field function code
function extracatchy_disable_comment_url($fields) { unset($fields['url']); return $fields; } add_filter('comment_form_default_fields','extracatchy_disable_comment_url');
Genesis Theme Remove URL Field – Method 4
Below is the simple and effective code snippets that will help you remove the URL field from the comment box. This snippet is especially for Genesis Theme and does work like a charm.
Steps to Use Remove URL function.
- Open of your’s child theme’s functions.php
- Copy the below code.
- Paste it.
- Save and check your website.
- Done!
Genesis Theme Remove URL Field Code
add_filter( 'genesis_comment_form_args', 'url_filtered' ); add_filter( 'comment_form_default_fields', 'url_filtered' ); function url_filtered( $fields ) { if ( isset( $fields['url'] ) ) unset( $fields['url'] ); if ( isset( $fields['fields']['url'] ) ) unset( $fields['fields']['url'] ); return $fields; }
Hope above code snippets works on your WordPress Theme. Feel free to comment and say thanks or if you have any query let us know in comment.