BIOS,Windows, Linux, Software,Security, Domains, Web Hosting

How to Change Avatar in WordPress

There are serveral default avatars in wordpress, but many people don't like them, If you want to change the default avatar, you can choose a convenient method for yourself instead of all of them listed below.

Method 1: Change Default Avator From Setting > Discussion

Screenshot shown here:

Click Save changes after your selection.

Method 2: Change the default avatar by codes

Modify the default function named get_avatar(), usually you can find it in your theme's files.

<?php echo get_avatar( $id_or_email, $size, $default, $alt ); ?>


  • id_or_email - Author's user ID or an e-mail address.
  • size - The size of gravatar to return.
  • default - The default avatar.
  • alt - Alternate text for the avatar

We can change the default avatar by changing default parameter in function. for example:

<?php echo get_avatar( $id_or_email, $size,get_bloginfo('template_url'). '/images/new-avatar.jpg', $alt ); ?>

OK, finished, you can accomplish this syntax in your theme's files, such as single.php and page.php, etc.

Remember create a image named new-avatar.jpg and place it in your theme's directory images.

Methe 3: Add filter to the avatar processing

Open your functions.php in your theme, add this code:

function new_avatar ( $avatar_defaults ) {
$myavatar = get_bloginfo('template_url'). '/images/new-avatar.jpg';
$avatar_defaults[$myavatar] = "Default Avatar";
return $avatar_defaults;
add_filter( 'avatar_defaults', 'new_avatar' );

Okay, you can change the default avatar in your wordpress dashboard(Settings - Discussion), screenshot shown above. Surely a image called new-avatar.jpg should be placed in the images directory under the current theme as mentioned above.

See also:

Related Articles


Leave a Reply

Subscribe to BootBeta Comments RSS feed to receive notification of latest comments posted.


  • Enter Email Address:

Recent Post

Copyright@ 2010-2014 Bootbeta All Rights Reserved.
HooBlog Ver 1.5 Build 20140530