get_avatar filter-hookWP 2.5.0

Filters the HTML for a user's avatar.

Usage

add_filter( 'get_avatar', 'wp_kama_get_avatar_filter', 10, 6 );

/**
 * Function for `get_avatar` filter-hook.
 * 
 * @param string $avatar      HTML for the user's avatar.
 * @param mixed  $id_or_email The avatar to retrieve. Accepts a user_id, Gravatar MD5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.
 * @param int    $size        Square avatar width and height in pixels to retrieve.
 * @param string $default     URL for the default image or a default type. Accepts '404', 'retro', 'monsterid', 'wavatar', 'indenticon', 'mystery', 'mm', 'mysteryman', 'blank', or 'gravatar_default'.
 * @param string $alt         Alternative text to use in the avatar image tag.
 * @param array  $args        Arguments passed to get_avatar_data(), after processing.
 *
 * @return string
 */
function wp_kama_get_avatar_filter( $avatar, $id_or_email, $size, $default, $alt, $args ){

	// filter...
	return $avatar;
}
$avatar(string)
HTML for the user's avatar.
$id_or_email(mixed)
The avatar to retrieve. Accepts a user_id, Gravatar MD5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.
$size(int)
Square avatar width and height in pixels to retrieve.
$default(string)
URL for the default image or a default type. Accepts '404', 'retro', 'monsterid', 'wavatar', 'indenticon', 'mystery', 'mm', 'mysteryman', 'blank', or 'gravatar_default'.
$alt(string)
Alternative text to use in the avatar image tag.
$args(array)
Arguments passed to get_avatar_data(), after processing.

Changelog

Since 2.5.0 Introduced.
Since 4.2.0 The $args parameter was added.

Where the hook is called

get_avatar()
get_avatar
wp-includes/pluggable.php 2872
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
wp-includes/pluggable.php 2803
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );

Where the hook is used in WordPress

Usage not found.