Below is the code to remove the website URL field from WordPress comment form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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.