Skip to main content

Website field in comment form in many cases doesn't have any purpose. Spammers often use it for posting their links and unfortunately WordPress doesn't have option for disabling the URL field.    

So, how to remove the website URL field from the WP comment form?

Different themes have different logic for displaying comment forms. Some themes use comments.php file calling core comment_form() method, others has comment forms fields inserted manually and some of them doesn't have comments.php file at all. So, you need to be ready to handle all these situations in order to remove the website field.

- Advertisement -

- If your theme doesn't contain comments.php file at all you need to copy it from /wp-includes/theme-compat/ folder into your theme's folder.

- If the comment form has fields inserted manually in comments.php file you could simply commented them out or delete.

- And finally, if comments.php file contains comment_form() you need to create trigger or filter that will override forms fields. Here is how you can do this:

In your theme's functions.php file add the following code at the end of the file (before closing ?> tag):

// Add filter for comment form
add_filter('comment_form_default_fields', 'url_filtered');
// Function for removing website url field
function url_filtered($fields)
	return $fields;

Save the file, refresh the page and website url field will not be present in WordPress comment form any more

- Advertisement -
- Advertisement -