0

I was wondering if the default image generated for a user in the comment section is "set" somewhere in the WordPress backend. If so, I'm not sure where this setting is. Please see this image to see what i'm referring to:

screenshot of images in comment section

The user Jimmy Jacob doesn't have an image yet the commentor Catherine does. Without installing plugins, is there a native WordPress setting which would let me upload a default image to use for this?

1

Here's a function you can put in your theme's functions.php file to force your own default avatar. Update the $myavatar line to point to your image path/name:

// Adds a new default avatar to the list in WordPress admin
add_filter( 'avatar_defaults', 'mytheme_addgravatar' );
function mytheme_addgravatar( $avatar_defaults ) {
    $myavatar = get_bloginfo('stylesheet_directory') . '/images/my-avatar.gif';
    $avatar_defaults[$myavatar] = 'New Default Gravatar';
    return $avatar_defaults;
}

Once you've added this function, your new avatar will appear in the list in the WP control panel in the "Settings > Discussion" area. Select it and save. Now if visitors don't have their own Gravatar your new avatar will appear instead.

(If you're just looking for how to get your own Gravatar, which will show up on most WordPress blogs/sites in the comments section, go to http://gravatar.com and sign up for a free account.)

Hope this helps - best of luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.