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.

  • 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

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'");

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.