WordPress Custom Avatar in comments

I have built my own frontend user avatar upload script. Now the avatars show fine in the user section in admin and in the top panel. However I can’t seem to get them showing in the comments and author sections of the site.

I use the following get_avatar code

add_filter ('get_avatar', function($  avatar_html, $  id_or_email, $  size, $  default, $  alt) { $  avatar = get_user_meta($  id_or_email,'avatar',true); if( $  avatar ) {     return '<img src="'.$  avatar.'" width="96" height="96" alt="Avatar" class="img-fluid rounded-circle" id="wad_profile_avatar" />'; } else {     return $  avatar_html; } 

}, 10, 5);

Any ideas how I can get it to show in comments also?