WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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

When I call the following code:

echo get_avatar(

It generates the following:


It is adding to the end of the default URL:


This prevents it from working and always returns the default image. If you remove the extra data from the URL it works.

share|improve this question
Quotes were needed around the parameter – John Aug 1 '12 at 8:01
Please add this as answer, then mark it as solution in 2 days. Thanks. – kaiser Aug 1 '12 at 11:23
Will do, just at the moment the system will not let me – John Aug 1 '12 at 11:34
Sure, you can add an answer. What exactly does the system tell you? – kaiser Aug 1 '12 at 12:35
"Users with less than 10 reputation can't answer their own question for 8 hours after asking. You may self-answer in 2 hours. Until then please use comments, or edit your question instead." - So guess just need to wait – John Aug 1 '12 at 13:10
up vote 1 down vote accepted

I worked out I needed to add quotes around the parameter.

echo get_avatar(get_the_author_meta('user_email'), '70', "'" . get_bloginfo('template_directory')."/images/default.png'");
share|improve this answer

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.