WordPress Tips

If you want to change the default Gravatar on your WordPress blog, then simply follow these steps:

  1. open your theme’s functions.php file and paste the following code at the end, then save it:

    add_filter( 'avatar_defaults', 'gioga_gravatar' );
    function gioga_gravatar ($avatar_defaults) {
    $my_avatar = get_stylesheet_directory_uri().'/images/avatar.png';
    // OR avatar URL --> $my_avatar = "https://giogadesign.com/gioga.png";
    $avatar_defaults[$my_avatar] = 'GioGa Avatar';
    return $avatar_defaults;
    }
  2. insert the new avatar file (avatar.png) inside your theme’s images folder;

  3. into your WordPress admin panel go to Settings → Discussion → Default Avatar section;

  4. select your new avatar and click the Save Changes button.

wp-gravatar

Please note that it will not work with localhost, only online.