In this tutorial we will go over steps on how to remove Comment Author Link and Website text area from WordPress comment form.
Let’s get started:
1. Remove Comment Author link from all existing WordPress comments
Before:
As you see here at bottom left corner, user’s link is easily clickable while hovering cursor over to Name in existing WordPress comment. How to remove Author link across all comments?
In order to remove author link, just put below code into WordPress’s functions.php file and you are all set.
function crunchify_remove_comment_author_link( $url, $id, $comment ) { return ""; } add_filter( 'get_comment_author_url', 'crunchify_remove_comment_author_link', 10, 3);
Here we are using get_comment_author_url
WordPress filter. It retrieves the URL of the author of the current comment, not linked.
After:
Here is a screenshot after adding above code. As you see here, there is no URL for an author.
2. Remove Website field from Comment Submit Form
WordPress by default gives you an option to provide Website URL while submitting form. What if you want to remove Website field from WordPress comment form?
Before:
Well, solution is very simple. Just add below comment_form_field_url
filter and return false and Website field wont be visible on Comment form. It formats the HTML-formatted output of the comment form field.
add_filter('comment_form_field_url', '__return_false');
After:
Here is a screenshot of our Comment form after adding above to functions.php file.
I hope this helps you fine tune WordPress comment form based on your need.
We do have a detailed on on how to customize WordPress comment form.