WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On the single post page I want to link the avatar function to the author profile, but I tried

<a href="<?php the_author_posts_link(); ?>">
<img src="<?php echo get_avatar($post->post_author, '64', $avatar); ?>">

but that doesn't work.

Also, how can I display the nickname (display name) and still link to the profile the following code gives a strange link and 404s

<a href="<?php echo get_author_posts_url(); ?>"><?php the_author_nickname(); ?></a>

some help would be greatly appreciated. Thanks

share|improve this question
First of all, the_author_posts_link() is a deprecated function since version 2.1, use get_author_posts_url() instead codex.wordpress.org/Function_Reference/get_author_posts_url; Second, make sure the code is not wrapped in a conditional <?php if ( get_the_author_meta( 'description' ) ) : and your description is not filled; other conditions may apply, check your code and make sure the requirements are met. This is as far as I can go without knowing in what way is it not working? Errors? Please edit your question to be more specific. – soulseekah Oct 17 '11 at 3:36
get_author_posts_url() takes an argument that requires "ID of the author whose URL should be retrieved." codex.wordpress.org/Function_Reference/get_author_posts_url, that's the reason you're getting a 404, because the page "warning: Missing argument 1 for get_author_posts_url()" does not exist on your server, does it? :) – soulseekah Oct 17 '11 at 3:43
I tried get_author_posts_url(), it doesnt change anything. Yes, im getting a 'missing argument for get_author_post_url, basically i want the <?php the_author_nickname(); ?> code to link to the author url, im putting the code in the single post page – Jack Stewart Oct 17 '11 at 3:55
Supply the argument, Jack... get_author_posts_url( get_the_author_meta( 'ID' ) ), let me know if you problem is solved so that I can compile an answer to this question. – soulseekah Oct 17 '11 at 3:57
get_author_posts_url( get_the_author_meta( 'ID' ) ) is linking to the current page, not the author page. EDIT: added an echo, worked like a charm – Jack Stewart Oct 17 '11 at 4:01
up vote 2 down vote accepted

This a short compilation of the multiple comments above, so that future visitors don't have to read each and every one of them.

First of all, the_author_posts_link() is a deprecated function since version 2.1, so get_author_posts_url() or the_author_posts_url() should be used instead http://codex.wordpress.org/Function_Reference/get_author_posts_url

The the/get_author_posts_url() takes an argument that requires "ID of the author whose URL should be retrieved.", so the_author_posts_url( get_the_author_meta( 'ID' ) ) will work, and if you decide to use the get_author_post_url() instead of the_author_posts_url() don't forget to echo it out.

share|improve this answer
Small correction - the_author_posts_link() is not deprecated, only passing arguments to it is deprecated – Mark Kaplun Jan 8 '13 at 21:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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