WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
| Line | Code |
|---|---|
| 4295 | * |
| 4296 | * @param array $args Arguments passed to get_avatar_data(), after processing. |
| 4297 | * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user ID, Gravatar MD5 hash, |
| 4298 | * user email, WP_User object, WP_Post object, or WP_Comment object. |
| 4299 | */ |
| 4300 | $args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email ); |
| 4301 | |
| 4302 | if ( isset( $args['url'] ) ) { |
| 4303 | /** This filter is documented in wp-includes/link-template.php */ |
| 4304 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
| 4305 | } |
| 4306 | |
| 4307 | $email_hash = ''; |
| 4308 | $user = false; |
| 4309 | $email = false; |
| 4310 | |
| 4311 | if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) { |
| 4312 | $id_or_email = get_comment( $id_or_email ); |
| 4313 | } |
| Line | Code |
| 4327 | // User object. |
| 4328 | $user = $id_or_email; |
| 4329 | } elseif ( $id_or_email instanceof WP_Post ) { |
| 4330 | // Post object. |
| 4331 | $user = get_user_by( 'id', (int) $id_or_email->post_author ); |
| 4332 | } elseif ( $id_or_email instanceof WP_Comment ) { |
| 4333 | if ( ! is_avatar_comment_type( get_comment_type( $id_or_email ) ) ) { |
| 4334 | $args['url'] = false; |
| 4335 | /** This filter is documented in wp-includes/link-template.php */ |
| 4336 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
| 4337 | } |
| 4338 | |
| 4339 | if ( ! empty( $id_or_email->user_id ) ) { |
| 4340 | $user = get_user_by( 'id', (int) $id_or_email->user_id ); |
| 4341 | } |
| 4342 | if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) { |
| 4343 | $email = $id_or_email->comment_author_email; |
| 4344 | } |
| 4345 | } |
| Line | Code |
| 4394 | /** |
| 4395 | * Filters the avatar data. |
| 4396 | * |
| 4397 | * @since 4.2.0 |
| 4398 | * |
| 4399 | * @param array $args Arguments passed to get_avatar_data(), after processing. |
| 4400 | * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user ID, Gravatar MD5 hash, |
| 4401 | * user email, WP_User object, WP_Post object, or WP_Comment object. |
| 4402 | */ |
| 4403 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
| 4404 | } |
| 4405 | |
| 4406 | /** |
| 4407 | * Retrieves the URL of a file in the theme. |
| 4408 | * |
| 4409 | * Searches in the stylesheet directory before the template directory so themes |
| 4410 | * which inherit from a parent theme can just override one file. |
| 4411 | * |
| 4412 | * @since 4.7.0 |