• devengeorg

    (@devengeorg)


    Can you please help in the comment section I want it to become do follow. Only my comment not readers comment.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    We should need to create a new function to modify the default comment author link output. Do it in a child theme’s functions.php file. Create it, in case you don’t have it yet.

    Then add the following PHP code into child theme’s functions.php file.

    add_filter('get_comment_author_link', 'prefix_fashionistas_dofollow_author_comment', 10);
    function prefix_fashionistas_dofollow_author_comment(){
    
    	$comment = get_comment($comment_ID);
    
    	$url    = get_comment_author_url( $comment_ID );
    	$author = get_comment_author( $comment_ID );
    
    	$rel = 'nofollow';
    	if ( $comment->user_id > 0 && $user = get_userdata( $comment->user_id ) ) {
    		$rel = 'dofollow';
    	}
    
    	if ( empty( $url ) || 'https://' == $url )
    		$return = $author;
    	else
    		$return = "<a href='$url' rel='external ".$rel."' class='url'>$author</a>";
    
    	return $return;
    
    }

    I hope it helps.

    Thread Starter devengeorg

    (@devengeorg)

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘make comment links to author do follow?’ is closed to new replies.