Add customized default avatars… php function won't work

  • Author
  • #1073272


    Hi, I’ve looked online and found a way to add default avatar into wordpress. I’ve followed what was described and have been trying for a while now, but nothing seems to work, so I’m asking for a little help.

    For info, I’m using the catch-box theme.
    So here’s what I did :

    1) created a 96×96 pixels jpg file
    2) saved the image in ‘wp-content/themes/catch-box/images’
    3) opened functions.php (in catch-box folder)
    4) pasted the code I found, somewhere in the file :

    add_filter( ‘avatar_defaults’, ‘newgravatar’ );

    function newgravatar ($avatar_defaults) {
    $myavatar = get_bloginfo(‘template_directory’) . ‘/images/my_image.jpg’;
    $avatar_defaults[$myavatar] = “My Image”;
    return $avatar_defaults;

    And nothing ! It didn’t work.

    I also tried the “get_stylesheet_directory_uri() ” instead of get_bloginfo.

    I put the php tag (or I don’t know what it’s called) before and after.
    Also tried without…
    And still nothing.


    So, my questions are:

    1) Is the code correct? What else could I try?
    2) Where exactly in functions.php should I save these lines of code
    (without messing things up ; ))
    3) If I repeat this code, could I add a 2nd new default avatar?

    4) My blank avatar in settings is now showing a “question mark” in a blue square (?) / Before it was a “white square”..
    Why is that? And could it be the origin of my other problem?

    THANK YOU very very much for your help..
    I’m usually very motivated to find things on my own.. and I eventually succeed ! But this time, I’m stuck.




    You did not specify a blog address or reason for posting when you created this topic.

    This support forum is for blogs hosted at If your question is about a self-hosted WordPress blog then you’ll find help at the forums.

    If you don’t understand the difference between and, you may find this information helpful.

    If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.

    This is an automated message.

The topic ‘Add customized default avatars… php function won't work’ is closed to new replies.