How to add custom avatar icon in WordPress
To add custom avatar image in wordpress, pest this code into theme functions.php
<?php /* Add a Custom Default Gravatar */ add_filter( 'avatar_defaults', 'new_avatar' ); function new_avatar($avatar_defaults){ $new_avatar = get_stylesheet_directory_uri() . '/images/avater_icon.jpg'; $avatar_defaults[$new_avatar] = "Theme Default Icon"; return $avatar_defaults; } ?>
avater_icon.jpg is your custom icon should be uploaded into theme images folder. Size of this icon can be 80px X 80px size.
To activate your custom icon, go to Discussion panel through dashboard. You will see a new icon appeared at the end of Default Avatar section. Select it and click save changes.