Support » Fixing WordPress » Link to author’s posts without displaying their name

  • In my category, search, etc… templates I’m displaying an image for each of the authors:

    <img src="<?php bloginfo('template_url'); ?>/images/authors/<?php the_author_ID(); ?>.gif" alt="<?php the_author(); ?>" />

    I’d like to wrap that in an href that links to each author’s page ( The only function I could find that returns that link is the_author_posts_link. Unfortunately, it automatically wraps that link around their name and there’s no parameter (that I can see) to only display their link without the name.

    Is there any way to just echo the link to their author page?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You mean like echo get_the_author_url()?

    wouldn’t that link to their website as specified in their profile?

    anyway, since all author links are the same, it should be a fairly simple matter to construct the permalink based on the author’s display name if using pretty permalinks (or based on their ID maybe? if not… I dunno what the format is for ugly permalinks, but whatever it is, it’ll be similar for all authors).

    I couldn’t find a function to return just the URL to an author’s posts.

    Like Ivovic said, that would echo the author’s url they set in their profile. Not quite what I’m after.

    Using this href:

    <a href="<?php bloginfo('url'); ?>/author/<?php the_author_nickname(); ?>"></a>

    …around the author’s image does the trick of linking to their author profile. For SEO purposes, it’d probably be best if you/I make sure all the author nicknames are lowercase and contain no spaces, otherwise you’d see

    Luckily, I don’t need to display the author’s nickname as text in my template, the avatar is all I need so I think this should do the trick.

    Thanks for your quick replies guys.

    to avoid having to set nicknames or keep track of your users, you can turn the above into:

    <a href="<?php bloginfo('url'); ?>/author/<?php echo strtolower(get_the_author()); ?>"></a>

    this makes sure that the link is valid, as the link relies on the display name as chosen, not the nickname field. The strtolower() part sends it to lowercase.


    I’ve just tried your solution, and it seems to work.

    But I have a question about it. On the site I’m working on, the author’s pages have a link that looks like this:


    There are hyphens between the first and last names.

    In the solution you posted, however, the link gets returned like this:

    blogurl/author/john smith

    with a space instead of a hypen, which gets interpreted by the browser like this:


    It pulls up the correct author url, but I’m just wondering if there are any problems with the fact that it’s not using the hyphens. Are hyphens and spaces considered the same in the url?

    (*grumble* I’m also wondering why the hell WP has never introduced a template tag that simply returns the unlinkified author URL…)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Link to author’s posts without displaying their name’ is closed to new replies.