0

I want to assign comment author link to author profile link (if comment author email is registered). Profile permalink is /user/UserName

I've come over this code which is link to author posts url-

add_filter('get_comment_author_link', 'author_comment_link_to_archives');
function author_comment_link_to_archives( $link ) {
    global $comment;
    if ( !empty( $comment->user_id ) && !empty( get_userdata( $comment->user_id )->ID ) ) {
        $link = sprintf(
            '<a href="%s" rel="external nofollow" class="url">%s</a>',
            get_author_posts_url( $comment->user_id ),
            strip_tags( $link )
        );
    }
    return $link;
}

How can I make this code to linked to user profile link?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.