DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Do you want to be able to use your gravatar as a favicon on your WordPress blog? That’s pretty easy to achieve with this trick. Enjoy!

First, edit the following function by adding your email adress on line 3, then paste it on your functions.php file.

function GravatarAsFavicon() {
	//We need to establish the hashed value of your email address
	$GetTheHash = md5(strtolower(trim('you@yourdomain.com')));
	echo 'http://www.gravatar.com/avatar/' . $GetTheHash . '?s=16';

Once done, open the header.php file of your theme and paste this:

<link rel="shortcut icon" href="<?php GravatarAsFavicon(); ?>" />
<link rel="apple-touch-icon" href="<?php GravatarAsFavicon(); ?>">

Thanks to Adam Whitcroft for the cool tip!


  1. Very easy to implement, thanks a lot Adam. 🙂

  2. Thanks thats just a small job. For some reason the function GravatarAsFavicon() { part once copied to clipboard changed the () but i missed that , works!

    NIce blog to!

  3. The problem I have is when reducing my Gravatar to 16 by 16 pixels I get a fuzzy mess which doesn’t look good. Is there any way I could sharpen the image before using it as my favicon? I’m good with Photoshop but not that good.

  4. if (!function_exists(‘insert_favicon’)) {
    function insert_favicon() {
    echo ”;
    add_action(‘wp_head’,’insert_favicon’, 1);

  5. This is really neat and interesting. Useful for personal blogs where people write about themselves and their daily life issues.

  6. I would like to share 1 thing more with you people by using Gravatar your email address becomes secure and no one use it for any type of blog post without your authorization.

  7. So, this is just php I see, if I want to do it in my site, I just must do the same?

Leave a Comment

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