apply_filters( 'get_avatar', string $avatar, mixed $id_or_email, int $size, string $default_value, string $alt, array $args )
- Since
- 2.5.0, 4.2.0
Filters the HTML for a user's avatar.
Compatibility
- WordPress
- since 4.2.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$avatarstring- HTML for the user's avatar.
$id_or_emailmixed- The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.
$sizeint- Height and width of the avatar in pixels.
$default_valuestring- URL for the default image or a default type. Accepts:
- '404' (return a 404 instead of a default image)
- 'retro' (a 8-bit arcade-style pixelated face)
- 'robohash' (a robot)
- 'monsterid' (a monster)
- 'wavatar' (a cartoon face)
- 'identicon' (the "quilt", a geometric pattern)
- 'mystery', 'mm', or 'mysteryman' (The Oyster Man)
- 'blank' (transparent GIF)
- 'gravatar_default' (the Gravatar logo) $altstring- Alternative text to use in the avatar image tag.
$argsarray- Arguments passed to get_avatar_data(), after processing.
Where this hook fires · 2
wp-includes/pluggable.php:3259get_avatar()wp-includes/pluggable.php:3357get_avatar()
Source code
* - 'mystery', 'mm', or 'mysteryman' (The Oyster Man) * - 'blank' (transparent GIF) * - 'gravatar_default' (the Gravatar logo) * @param string $alt Alternative text to use in the avatar image tag. * @param array $args Arguments passed to get_avatar_data(), after processing. */ return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args ); }endif; if ( ! function_exists( 'wp_text_diff' ) ) : /** * Displays a human readable HTML representation of the difference between two strings.Changelog
Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.2.0
Added the
$args parameter.from the docblock2.5.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.