get_avatar_data( mixed $id_or_email, array $args = null ): array
- Since
- 4.2.0, 6.7.0, 6.8.0
- Source
wp-includes/link-template.php:4415
Compatibility
- WordPress
- since 6.8.0
- PHP
- 7.4–8.6-dev
- 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), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$id_or_emailmixed- The avatar to retrieve. Accepts a user ID, Gravatar SHA-256 or MD5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.
$argsarrayoptional- Arguments to use instead of the default arguments.Default:
null$sizeintdefault: 96Height and width of the avatar in pixels.$heightintDisplay height of the avatar in pixels. Defaults to $size.$widthintDisplay width of the avatar in pixels. Defaults to $size.$defaultstringdefault: is the value of the 'avatar_default' option, with a fallback of 'mystery'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)
$force_defaultbooldefault: falseWhether to always show the default image, never the Gravatar.$ratingstringdefault: is the value of the 'avatar_rating' optionWhat 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)
$schemestringdefault: nullURL scheme to use. See set_url_scheme() for accepted values. For Gravatars this setting is ignored and HTTPS is used to avoid unnecessary redirects. The setting is retained for systems using the 'pre_get_avatar_data' filter to customize avatars.$processed_argsarraydefault: nullWhen the function returns, the value will be the processed/sanitized $args plus a "found_avatar" guess. Pass as a reference.$extra_attrstringdefault: emptyHTML attributes to insert in the IMG element. Is not sanitized.
Return value
array- Along with the arguments passed in
$args, this will contain a couple of extra arguments.$found_avatarboolTrue if an avatar was found for this user, false or not set if none was found.$urlstring|falseThe URL of the avatar that was found, or false.
Performance profile
How much work a call to get_avatar_data() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Heavy
- Scaling
- Constant
- Instructions
- 126–207
- Plugin surface
- 3 hooks
- Called by
- 3
Reaches the database via get_user_by().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 369.
Third-party callbacks on 'pre_get_avatar_data', 'get_avatar_data', 'get_avatar_url' run inside this call, and their cost is not bounded by anything here.
3 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- optionoption read or write
get_option()called directly - hookthird-party callbacks
apply_filters()called directly - querycontent query
get_user_by()called directly - cacheobject cache
wp_cache_get()one call below get_avatar_data() - serializeserialisation
maybe_unserialize()one call below get_avatar_data()
Further down the call graph this can also reach transient. That is the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 36 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost get_avatar_data() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) | 126–149 | get_option(), get_option(), size(), strtolower(), apply_filters(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) | 136–158 | get_option(), get_option(), size(), strtolower(), apply_filters(), strtolower(), hash(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) | 138–162 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) | 140–165 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) | 148–171 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), strtolower(), hash(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) | 150–172 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), strtolower(), hash(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $name !== "" | 151–168 | get_option(), get_option(), size(), strtolower(), apply_filters(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $name === "" | 152–158 | get_option(), get_option(), size(), strtolower(), apply_filters(), _x(), sprintf(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $name !== "" | 160–175 | get_option(), get_option(), size(), strtolower(), apply_filters(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $name !== "" | 161–177 | get_option(), get_option(), size(), strtolower(), apply_filters(), strtolower(), hash(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $name === "" | 162–167 | get_option(), get_option(), size(), strtolower(), apply_filters(), strtolower(), hash(), _x(), sprintf(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 163–181 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
24 further outcomes, up to 207 instructions
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name === "" | 164–171 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), _x(), sprintf(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 165–184 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name === "" | 166–174 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), _x(), sprintf(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $name !== "" | 169–177 | get_option(), get_option(), size(), strtolower(), apply_filters(), _x(), sprintf(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $name !== "" | 170–184 | get_option(), get_option(), size(), strtolower(), apply_filters(), strtolower(), hash(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 172–188 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 173–190 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), strtolower(), hash(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name === "" | 174–180 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), strtolower(), hash(), _x(), sprintf(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 174–191 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 175–191 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), strtolower(), hash(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name === "" | 176–181 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), strtolower(), hash(), _x(), sprintf(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $name !== "" | 178–184 | get_option(), get_option(), size(), strtolower(), apply_filters(), _x(), sprintf(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $name !== "" | 179–186 | get_option(), get_option(), size(), strtolower(), apply_filters(), strtolower(), hash(), _x(), sprintf(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 181–190 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), _x(), sprintf(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 182–197 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), strtolower(), hash(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 183–193 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), _x(), sprintf(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 184–198 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), strtolower(), hash(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $name !== "" | 188–193 | get_option(), get_option(), size(), strtolower(), apply_filters(), strtolower(), hash(), _x(), sprintf(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 190–197 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), _x(), sprintf(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 191–199 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), strtolower(), hash(), _x(), sprintf(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !$id_or_email && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 192–200 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), _x(), sprintf(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 193–200 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), strtolower(), hash(), _x(), sprintf(), mb_strlen(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 200–206 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), strtolower(), hash(), _x(), sprintf(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
!empty($args) && $args && !isset($args) && !is_object($id_or_email) && !is_string($id_or_email) && !($id_or_email instanceof) && $id_or_email instanceof && is_avatar_comment_type() && empty($id_or_email) && $name !== "" | 202–207 | get_option(), get_option(), size(), strtolower(), apply_filters(), get_comment_type(), is_avatar_comment_type(), is_wp_error(), strtolower(), hash(), _x(), sprintf(), mb_substr(), strrpos(), mb_substr(), array_filter(), rawurlencode_deep(), add_query_arg(), apply_filters(), apply_filters() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 369 | 126–207 | 43 | |
| 8.5 | 369 | 126–207 | 43 | |
| 8.4 | 369 | 126–207 | 43 | 37 fewer instructions than PHP 8.3 |
| 8.3 | 406 | 134–210 | 43 | |
| 8.2 | 406 | 134–210 | 43 | 1 more instruction than PHP 8.1 |
| 8.1 | 405 | 134–210 | 43 | |
| 7.4 | 405 | 134–210 | 43 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 5
5 hooks fire while get_avatar_data() runs, in this order:
- apply_filters( pre_get_avatar_data )filterline 4492 (+77 into the body)
Filters whether to retrieve the avatar URL early.
Uses · 15
- wp_parse_args()Merges user defined arguments into defaults array.
- get_option()Retrieves an option value based on an option name.
- absint()Converts a value to non-negative integer.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- get_comment()Retrieves comment data given a comment ID or comment object.
- get_user_by()Retrieves user info by a given field.
- str_contains()Polyfill for `str_contains()` function added in PHP 8.0.
- is_avatar_comment_type()Check if this comment type allows avatars to be retrieved.
- get_comment_type()Retrieves the comment type of the current comment.
- is_wp_error()Checks whether the given variable is a WordPress Error.
- _x()Retrieves translated string with gettext context.
- mb_substr()Compat function to mimic mb_substr().
Show all 15
- mb_strlen()Compat function to mimic mb_strlen().
- add_query_arg()Retrieves a modified URL query string.
- rawurlencode_deep()Navigates through an array, object, or scalar, and raw-encodes the values to be used in a URL.
Used by · 3
- get_avatar()Retrieves the avatar `` tag for a user, email address, MD5 hash, comment, or post.
- get_avatar_url()Retrieves the avatar URL.
- wp_credits_section_list()Displays a list of contributors for a given group.
Source code
function get_avatar_data( $id_or_email, $args = null ) { $args = wp_parse_args( $args, array( 'size' => 96, 'height' => null, 'width' => null, 'default' => get_option( 'avatar_default', 'mystery' ), 'force_default' => false, 'rating' => get_option( 'avatar_rating' ), 'scheme' => null, 'processed_args' => null, // If used, should be a reference. 'extra_attr' => '', ) ); if ( is_numeric( $args['size'] ) ) { $args['size'] = absint( $args['size'] ); if ( ! $args['size'] ) { $args['size'] = 96; } } else { $args['size'] = 96; } if ( is_numeric( $args['height'] ) ) { $args['height'] = absint( $args['height'] ); if ( ! $args['height'] ) { $args['height'] = $args['size']; } } else { $args['height'] = $args['size']; } if ( is_numeric( $args['width'] ) ) { $args['width'] = absint( $args['width'] ); if ( ! $args['width'] ) { $args['width'] = $args['size']; } } else { $args['width'] = $args['size']; } if ( empty( $args['default'] ) ) { $args['default'] = get_option( 'avatar_default', 'mystery' ); } switch ( $args['default'] ) { case 'mm': case 'mystery': case 'mysteryman': $args['default'] = 'mm'; break; case 'gravatar_default': $args['default'] = false; break; } $args['force_default'] = (bool) $args['force_default']; $args['rating'] = strtolower( $args['rating'] ); $args['found_avatar'] = false; /** * Filters whether to retrieve the avatar URL early. * * Passing a non-null value in the 'url' member of the return array will * effectively short circuit get_avatar_data(), passing the value through * the {@see 'get_avatar_data'} filter and returning early. * * @since 4.2.0 * * @param array $args Arguments passed to get_avatar_data(), after processing. * @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar SHA-256 or MD5 hash, * user email, WP_User object, WP_Post object, or WP_Comment object. */ $args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email ); if ( isset( $args['url'] ) ) {Changelog
Introduced in 4.2.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-includes/link-template.php, 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.