Add avatar for not comment type comments in WordPress

By default only comment type comments get avatars.

Sometimes I hate you, WordPress. Finding this took 3 hours of my life. In case you want avatars for comments with not โ€œcommentโ€ comment type field ( for example, you introduce like, favorite, etc. types ) you need this to be extended:

$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );

as

add_filter('get_avatar_comment_types', 'add_new_comment_types');

function add_new_comment_types ( $types ) {
    foreach ($this->methods as $method => $type ) {
        if (!in_array( $type, $types ))
            array_push( $types, $type );
    }
    return $types;
}


Encourage creation!

If this entry helped you, or you simply liked it, leave a tip.