Glossary Term
get_avatar()
get_avatar() — Retrieves the avatar <img> tag for a user, email address, MD5 hash, comment, or post.
Inputs: $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): Optional. Height and width of the avatar in pixels. Default 96. $default_value (string): 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) ‘initials’ (initials based avatar with background color) ‘color’ (generated background color) ‘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’. $alt (string): Optional. Alternative text to use in the avatar image tag. Default empty. $args (array): Optional. Extra arguments to retrieve the avatar. Field $height (int): Display height of the avatar in pixels. Defaults to $size. Field $width (int): Display width of the avatar in pixels. Defaults to $size. Field $force_default (bool): Whether to always show the default image, never the Gravatar. Default false. Field $rating (string): What rating to display avatars up to. Accepts: ‘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. Field $scheme (string): URL scheme to use. See set_url_scheme() for accepted values. Default null.
Returns string|false: <img> tag for the user’s avatar. False on failure.
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
