Below is the code to remove the website URL field from WordPress comment form.
<?php | |
//* Remove website URL field from WordPress comment form | |
function prefix_remove_website_field($fields) { | |
unset($fields['url']); | |
return $fields; | |
} | |
add_filter('comment_form_default_fields', 'prefix_remove_website_field'); |
If you want to remove the email address field as well, you can do so with the following snippet.
<?php | |
//* Remove both website and email fields from WordPress comment form | |
function prefix_custom_comment_fields($fields) { | |
unset($fields['url']); | |
unset($fields['email']); | |
return $fields; | |
} | |
add_filter('comment_form_default_fields', 'prefix_custom_comment_fields'); |
In the latter case, don’t forget to change the WordPress Discussion Settings. From your WordPress admin panel, go to Settings > Discussion > Other comment settings > and uncheck the “Comment author must fill out name and email” box.