Allows the HTML for a user’s avatar to be returned early.
Returning a non-null value will effectively short-circuit get_avatar() , passing the value through the ‘get_avatar’ filter and returning early.
$avatarstring|null
$id_or_emailmixed
$argsarray
size intdefault string'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) Default is the value of the 'avatar_default' option, with a fallback of 'mystery'.force_default boolrating string'G' (suitable for all audiences)'PG' (possibly offensive, usually for audiences 13 and above)'R' (intended for adult audiences above 17)'X' (even more mature than above) Default is the value of the 'avatar_rating' option.scheme stringprocessed_args array$avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args );
| Version | Description |
|---|---|
| 4.2.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/pre_get_avatar