How to remove link of author name in recent comments

0

Last modified: April 5, 2015


Are you want to remove the link from the authors name in wordpress comment blog ?today is simple tips how to remove link of author name in Recent comments.

remove-link-author-name-recent-comments

Although Author Comment Website URL suppose to be ‘no-follow’ attribute but sometime this harmful to your site SEO. Bellow are 2 ways to remove link on author name in wordpress blog. Hope this tip will helpful for you.

Remove Post Author Website Url in Comments without WordPress Plugin

First way: Open functions.php file in your current theme and add this code (we are recomment this way)

function unlink_comment_author($return) {
	global $comment;
		$author = get_comment_author();

	if ((get_comment_type() == 'comment')) {
		if ($comment->user_id > 0 && $user = get_userdata($comment->user_id))
			return $return;
		else
			return $author;
	} else {
		return $return;
	}
}

add_filter('get_comment_author_link', 'unlink_comment_author');

Second way: Edit WordPress Core file

– Open file : wp-includes/comment-template.php
– Search this function: get_comment_author_link and replace with this code

function get_comment_author_link( $comment_ID = 0 ) {
	$url    = get_comment_author_url( $comment_ID );
	$author = get_comment_author( $comment_ID );

	if ( empty( $url ) || 'http://' == $url )
		$return = $author;
	else
		$return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";

	/**
	 * Filter the comment author's link for display.
	 *
	 * @since 1.5.0
	 *
	 * @param string $return The HTML-formatted comment author link. Empty for an invalid URL.
	 */
	return apply_filters( 'get_comment_author_link', $return );
}

Replace with

function get_comment_author_link( $comment_ID = 0 ) {
	$url    = get_comment_author_url( $comment_ID );
        $url2 = get_the_permalink();
	$author = get_comment_author( $comment_ID );

	if ( empty( $url ) || 'http://' == $url )
		$return = $author;
	else
		$return = "<a href='$url2' rel='external nofollow' class='url'>$author</a>";

	/**
	 * Filter the comment author's link for display.
	 *
	 * @since 1.5.0
	 *
	 * @param string $return The HTML-formatted comment author link. Empty for an invalid URL.
	 */
	return apply_filters( 'get_comment_author_link', $return );
}

Video tutorial:

 

Remove Post Author Website Url in Comments with WordPress Plugin

Disable Author Url and Comment Links

Disable Author Url and Comment Links : DAUnCL helps you keep your comments clean from spam links left by automated or manual comment spammers who are after your valuable traffic. Based on SimpleHTMLDom Library, this plugin removes any external link from your blog comments and comment authors name which are not explicitly allowed by the administrator.

MORE/INFO

Done! If you have any question, do not hesitate to write comment bellow !

Share.

About Author

I'm a freelance with over 3 years experience working in PHP with CMS Wordpress and design website layout. In my spare time, I go fishing, lean internet marketing, scout new blogging strategies,free Xbox live gold codes and techniques, and work from wherever. View me on: Google+ | Facebook.

Comments are closed.