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


  1. Web design Hyderabad November 10, 2009
    • admin November 10, 2009
  2. Kevin Ronnie February 3, 2010
  3. AutoInsuranceGroup March 15, 2010
  4. web design jamshedpu September 6, 2012
  5. web designing compan September 6, 2012