Simple Steps To Change Default Gravatar In WordPress

WordPress is a beautiful blogging CMS and can be easily personalized, but at many case WordPress users are forced to use the default gravatars or avatar.  So in this post I will teach you how to change the default gravatar for your WordPress blogs. Basically WordPress comes with some default gravatars which can be see through Settings> Discussion. Hence this tutorial will teach you to add another default gravatar, which is going to be your custom made gravatar for your WordPress blog.  Lets head on to the tutorial.

Change default gravatar in WordPress

Step 1: Most of the WordPress theme has functions.php template file. So check for the file using Appearance > Editor. If you don’t find functions.php create a new PHP file with the name functions and paste the code within the file.

add_filter( 'avatar_defaults', 'newgravatar' );

function newgravatar ($avatar_defaults) {
    $myavatar = get_bloginfo('template_directory') . '/images/gravatar.jpg';
    $avatar_defaults[$myavatar] = "YourBlogName";
    return $avatar_defaults;
}

Once you add the code in functions.php, you need to change default path with your own, then type your blog name instead of YourBlogName and update the file. That’s it. (Make sure that you add the image file within the template directory and don’t use any external server to link up the image)

Step 2: Navigate to Settings > Discussion and at the bottom, you can see your new avatar being added to the default gravatar list. So just click on it and save the changes.

Wordpress dashboard discussion

Credits (Thanks to Zach for the original code)

May 21, 2010. This entry was posted in Tutorials, WordPress and tagged . Bookmark the permalink.

We Recommend HostGator Hosting

Bloggermint strongly recommends Hostgator Hosting for all of your web hosting needs. Sign up today for WordPress Hosting at just $4.95/month.

Use coupon code "bloggermint" to get 25% discount on any hosting packages. Get an account with Hostgator now!