Get Rid of WordPress Default Gravatar

Gravatar is one of the best / great features for WordPress. It is nothing but the image associated to your email id. Whenever you use this email address for placing comments or create profiles in WP blog, the image associated to your email is displayed.
You can read more about Gravatar on WP because this tutorial is not about ‘what is gravatar?’ So in this tutorial I am going to show you how to change the default “Mystery Man Gravatar” to your very own “Custom Gravatar”.
You can use gravatar in wordpress with the gravatar wordpress plugin or it can be manually added in index.php, comments.php and comments-popup.php
Many times the gravatar comes with the WordPress Theme, so in this case it is located in the functions.php file. This file is responsible for additional options of the theme which appears in the WordPress Dashboard. So let’s add the new gravatar.
Open functions.php file. Add the following code at the end of the file just before and save it.
/* Custom Gravatar */
add_filter( 'avatar_defaults', 'newgravatar' );
function newgravatar ($avatar_defaults) {
$myavatar = get_bloginfo('template_directory') . '/images/custom-gravatar.jpg';
$avatar_defaults[$myavatar] = "Custom";
return $avatar_defaults;
}
Upload Image:
Using ftp software like filezilla, Login to your hosting and upload image of your choice to use as avatar in ./wp-content/theme/yourcurrenttheme/images/custom-gravatar.jpg. Remember to rename image as custom-gravatar.jpg before upload to your hosting
Explanation:
First line is adding a “newgravatar” to the default avatars (avatar_defaults) available in the WordPress.
add_filter( 'avatar_defaults', 'newgravatar' );
![]()
Next the newgravatar function is providing the location of the image which is in the images folder of the WP installation directory and assigning a name “Custom” to it.
function newgravatar ($avatar_defaults) {
$myavatar = get_bloginfo('template_directory') . '/images/custom-gravatar.jpg';
$avatar_defaults[$myavatar] = "Custom";
![]()
And finally the output is sent back to default avatars (avatar_default) which displays the gravatar in the default gravatar list in the dashboard.
return $avatar_defaults;
Now go to your Dashboard->Setting->Discussion. Scroll down the page and select your new default gravatar, then Save Changes. And you are done.
So from now on there will be no Mystery men in your blog. Anyone leave a comment in your blog if they didn’t register with gravatar their image will be replace with your new custom gravatar. If you are real blogger you must use gravatar and registered, gravatar is your personalities ok. p/s you can use your own image, just rename the image before upload. This is what Ichi used now, give it a try and ichi wish a good luck.
What do you think about the Mystery Man? Nice, Cool, or Not Cool at All. Do you want to keep the Default Gravatar or want your own Custom Gravatar? Please Let Ichi know in the Comment!
Related Articles
- How to Implement Syntax Highlighter on Blogger
- How To Backup, Restore Entry, Comment
- How To Install Windows 7
- Memasukkan Sitemap ke Webmaster Tools
- Cara Cepat Install Win 7
- Adding Tooltip To Your Label Link
- Matikan fungsi recent dokumen xp
![wazy84[dot]com](http://www.auracyber.net/Friends-Connect/bannerwazy.jpg)


wazy´s last blog ..Adobe Photoshop CS3 & CS4 Portable
[Reply]
Ichigo reply on March 5th, 2010 at 10:50 pm
welcome bro wazy.. mentang2 la entri lan english komen pn nak english gak.. hik hik
[Reply]
wazy reply on March 5th, 2010 at 10:55 pm
Hehehe saja je bro,ikut syle ko gak la
wazy´s last blog ..Adobe Photoshop CS3 & CS4 Portable
[Reply]
Ichigo reply on March 5th, 2010 at 11:03 pm
kadang2 tu kena gak guna english, ikut kesesuaian penerangan la
[Reply]
kulanz´s last blog ..Saya Dah Buang Iklan Innity?
[Reply]
Ichigo reply on March 6th, 2010 at 12:11 am
haha tu la pasal, suka suki jer dia generate monster kan. ^_^
[Reply]
Roslan´s last blog ..Blog Aku Do Follow, Blog Anda Bagaimana?
[Reply]
Ichigo reply on March 7th, 2010 at 5:25 pm
hehe ok la tu.. mana tau lenkali nak ubah selera kan.
[Reply]
[Reply]
Ichigo reply on March 8th, 2010 at 11:28 pm
itula bro.. yg bagusnya, bleh la set icon kegemaran ataupn yg nmpk macho sket kan
[Reply]
mancai´s last blog ..google, kata benda yang akan menjadi kata kerja
[Reply]
Ichigo reply on March 20th, 2010 at 8:03 pm
sama-sama bro…
[Reply]
Azizi Zulkefli´s last blog ..E-Mel Pembaca
[Reply]
[Reply]
[Reply]
cuba nanti..
lain dari yg lain…
syahrilhafiz´s last blog ..Backtrack Di Genggamanku
[Reply]