Change the Default Avatar / Gravatar Image in WordPress

WordPress has a default avatar for user. Which is known as Mystery Man. But you can Change the Default Avatar / Gravatar Image in WordPress. There could be few reasons:

  1. Mystery man is not so Mysterious, as many users define it as  “Boring” or “Annoying”
  2. You may want to brand your blog

Anyhow, you need to follow the steps to change the default avatar image with something better matching for your blog:

  1. Upload your new avatar image in active theme dir ( supposed the name is newavatar.png )
  2. Open your functions.php which is located in your active theme folder.
  3. Add following code at the end of the file:
    add_filter( 'avatar_defaults', 'default_avatar' );
    function default_avatar ($default_avatar) {
        $newavatar = get_stylesheet_directory_uri() . '/newavatar.png';
        $default_avatar[$newavatar] = "Custom Avatar Name";
        return $default_avatar;
  4. Save and close the file

Post Tags

About The Author

Leave a Reply

Your email address will not be published. Required fields are marked *