How to Remove Comment Author URL in WordPress

Posted by Lasantha Bandara on August 13th, 2015 File Under : comments, wordpress0 Comment

When someone writes a comment on your WordPress website, he can/is required to fill his Name (Required), Email (Required) and Website URL. If we remove the Website URL field from the WordPress comment form (using some PHP code), number of comments receiving to your blog can be dropped in a bad way. But adding the code given below into your functions.php file, WordPress comment authors names will be shown as plain text without linking to their websites.

function btt_remove_comment_author_link($output) {
	global $comment;
	
	$author = get_comment_author();
	
	if ((get_comment_type() == 'comment')) {
		if ($comment->user_id > 0 && $user = get_userdata($comment->user_id))
			return $output;
		else
			return $author;
	} else {
		return $output;
	}
}
add_filter('get_comment_author_link', 'btt_remove_comment_author_link');

File Under : comments, wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.