If you want to change the default Gravatar on your WordPress blog, then simply follow these steps:
-
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; }
-
insert the new avatar file (avatar.png) inside your theme’s images folder;
-
into your WordPress admin panel go to Settings → Discussion → Default Avatar section;
-
select your new avatar and click the Save Changes button.
Please note that it will not work with localhost, only online.