wpblooms - WordPress Support

Published:

How to Remove Website URL Field from WordPress Comment Form?

WordPress

I wanted to remove website URL field from WordPress comment form. So I Google it and found some nice results. wpbeginner.com nicely explained why we should remove the URL field from the WordPress comment form. But their code did not work for me and I did not want to use the plugin method.

So I jumped on the other sites and found the right code on wplogout.com as I am using the GeneratePress theme. It makes sense that we have to use/write the code according to our theme.

Here is the code –

				
					add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );
function tu_add_comment_url_filter() {
    add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );
}

function tu_disable_comment_url($fields) {
    unset($fields['url']);
    return $fields;
}
				
			

Implementation

Process 1:

We have to add the code to the functions.php file. If you follow this method, I strongly recommend using a child theme.

Process 2:

If you don’t have or are not familiar with the child theme then you may use Code Snippets or WPCode plugin for adding the code.

Process 3:

If you want to avoid the above processes then you may use Comment Link Remove and Other Comment Tools plugin to remove the website URL field from the comment form.

In this case, I suggest not using the CSS property (display: none). Because an advanced user can enable/visible the URL field by using the browser Inspector and will be able to submit the URL.

Share on social media:

Need help with WordPress Development?

Need help with WordPress website development?

Need help with updating/editing website content?

Need help with updating (weekly) WordPress?

Need help with WordPress backup?

Need help learning WordPress?

Need help learning Elementor Pro?

Leave a Comment

What about

20% OFF?