/**
* This can be used to apply a custom default avatar to your WordPress
* install. Change the $custom_avatar value below to the specific URL
* of the custom image you'd like to use.
*
* @uses avatar_defaults
* @see https://developer.wordpress.org/reference/hooks/avatar_defaults/
*
* Note: This is for the DEFAULT avatar you set in Settings > Discussion
* for when the user does not have an avatar. Using a custom image
* for a specific user's avatar is something different.
*/
add_filter( 'avatar_defaults', function( $avatar_defaults ) {
$custom_avatar = 'https://yourdomain.com/wp-content/uploads/path/to/file/custom_avatar_image.png';
$avatar_defaults[ $custom_avatar ] = "Custom Avatar";
return $avatar_defaults;
});
Add a custom default avatar to WordPress
This post brought to you by RocketGeek, ButlerBlog, and the following: