Loading

How to change your Default avatar in wordpress




Adding a new avatar image to the default wordpress avatar called mystery man was always a new bloggers problem, Follow our tutorial and choose avatar which is more suitable to your theme.

Open your theme’s functions.php file and add this new function.

add_filter( 'avatar_defaults', 'newgravatar' );
function newgravatar ($avatar_defaults) {
$myavatar = get_bloginfo('template_directory') . '/images/my-gravatar.jpg';
$avatar_defaults[$myavatar] = "My Avatar";
return $avatar_defaults;
}

We are done. Using the add_filter function we changed the avat_default function a little bit, with newgravatar function. We added our new avatar in default wordpress avatar list. Change my-gravatar.jpg with your own. This file must be located in /images/ folder of your theme.

Now in order to change your default avatar go to Settings>Discussion and choose your image.

Cheers, Joshu

You might want to read these as well

Loading...







How to change your Default avatar in wordpress

Joshu is the Founder of the OrangeCopper Webmaster's Community, He had been designing & developing web applications as a freelancer in this field for the past 9 years. OC was born in 2002 December and since 2004 Joshu had been Blogging on the Web about what he learned the Hard way, So that you could learn it the Easy Way. Follow OrangeCopper on Twitter and you would be Auto-Followed.


  • Out of all of the sites that I've been too, this is the only one that actually made sense, and got my site to show custom avatars without messing up the code x_x

    THANK YOU!
  • AutoInsuranceGroup
    The webpage is actually full of outstanding detail and is actually really exciting to read.

    Properly done.
  • Kevin Ronnie
    i did not quiet get this working on changing the mistery man avatar, could you help me a lil further josh, ?

    -kevin
  • Exactly what i was searching for.
    Also do you know can these be done automatically by any plugins ?

    Do let me know ....
  • Hey !

    Infact this is the simplest method, And plugins are there, they will only allow your memebrs to add local avatars at the time of posting. (as far as i know)
    Do this and easly add more and more avatars !
    Cheers, Josh
blog comments powered by Disqus