When I hover over the comment author link on my comments, it shows a link like http://mysitenameeeee.com/?author=24

After I click it, it gets me to /author/authorname, which is fine, but I don't want the link to be author=24 when I hover it. If I hover the post author link, it shows me the correct link to author.php. What is the difference, why and how can I solve it?

Here is the snippet:

<a rel="author" href ="<?php bloginfo('url'); ?>/?author=<?php echo $comment->user_id ?>"><?php echo $comment->comment_author?></a>
  • How to fix it? Idk if you can change that. Wordpress assigns the user id number to users who have not posted, and uses the user name for users who have posted. (posted ie: written a post).
    – Vigs
    Jul 20 '13 at 14:44
  • I think this is a duplicate of wordpress.stackexchange.com/questions/94565/… – do you agree?
    – fuxia
    Jul 20 '13 at 15:07

Use get_comment_author_link() instead of <a href … </a>:

echo get_comment_author_link();
  • Edit. Got it to work by adding /author/ in the href. Thanks mate!
    – Johan
    Jul 20 '13 at 15:31

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.