Adrianna Mayo
Adrianna Mayo

Reputation: 83

Comment Author Link on Wordpress for all comments

Comment Author Link on Wordpress

This is a question based on the solution provided in above post.

There it replace the comment author link for those who dont have a link. Is it possible to do this for all comments. (all comment authors will be linked to author page")

Upvotes: 0

Views: 281

Answers (1)

loQ
loQ

Reputation: 2136

How about you try this

function force_comment_author_url($comment)
{
    // does the comment have a valid author URL?
    $no_url = !$comment->comment_author_url || $comment->comment_author_url == 'http://';


    $comment->comment_author_url = get_author_posts_url($comment->user_id);

   return $comment;
}
add_filter('get_comment', 'force_comment_author_url');

get_author_posts_url docs

Upvotes: 1

Related Questions