Add custom class in avatar image via filter hooks.
To add a custom class in wordpress avatar image, we have to use filter hooks in get_avatar function.
Filter hooks example:
//avatar custom class
function my_avatar_custom_class($avatar, $id_or_email, $size, $default, $alt, $args) {
$avatar = '<img src='. get_avatar_url( get_the_author_meta('ID'), $size = '80' ) .' class=" avatar avatar-' . $size .' photo rounded-circle" height='. $size .' width='. $size .' />';
return $avatar;
}
// add the filter
add_filter( "get_avatar", "my_avatar_custom_class", 10, 6 );
get_avatar function for details : https://developer.wordpress.org/reference/functions/get_avatar/
appy filter hooks for details : https://developer.wordpress.org/reference/hooks/get_avatar/