How to Change or Add New Default Comment Avatar in WordPress

WordPress don’t provide any option to add default avatar directly from comment discussion page ,you can either disable or  use available default avatar provided by wordpress .

But if you are looking to add your own default Comment avatar in WordPress then you can do this by adding this little function to functions.php of your theme and it will add 2 Avatar from your folderimages of your theme directory.

/** * add a default-gravatar to options */
if ( !function_exists('fb_addgravatar') ) { function fb_addgravatar( $avatar_defaults ) { $myavatar = get_bloginfo('template_directory') . '/images/avatar.gif'; $avatar_defaults[$myavatar] = 'techpur'; $myavatar2 = get_bloginfo('template_directory') . '/images/myavatar.png'; $avatar_defaults[$myavatar2] = 'techpur.com'; return $avatar_defaults; } add_filter( 'avatar_defaults', 'fb_addgravatar' ); }

Please Note, that the avatars have a size of 60 pixel.You can also use more px avatar but it may effect you comment box look.

Advertisement