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 |
---|---|
3523 | * @since 4.2.0 |
3524 | * |
3525 | * @param array $args Arguments passed to get_avatar_data(), after processing. |
3526 | * @param int|object|string $id_or_email A user ID, email address, or comment object. |
3527 | */ |
3528 | $args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email ); |
3529 |
|
3530 | if ( isset( $args['url'] ) && ! is_null( $args['url'] ) ) { |
3531 | /** This filter is documented in wp-includes/link-template.php */ |
3532 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
3533 | } |
3534 |
|
3535 | $email_hash = ''; |
3536 | $user = $email = false; |
3537 |
|
3538 | // Process the user identifier. |
3539 | if ( is_numeric( $id_or_email ) ) { |
3540 | $user = get_user_by( 'id', absint( $id_or_email ) ); |
3541 | } elseif ( is_string( $id_or_email ) ) { |
Line | Code |
3560 | * |
3561 | * @since 3.0.0 |
3562 | * |
3563 | * @param array $types An array of content types. Default only contains 'comment'. |
3564 | */ |
3565 | $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); |
3566 | if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) { |
3567 | $args['url'] = false; |
3568 | /** This filter is documented in wp-includes/link-template.php */ |
3569 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
3570 | } |
3571 |
|
3572 | if ( ! empty( $id_or_email->user_id ) ) { |
3573 | $user = get_user_by( 'id', (int) $id_or_email->user_id ); |
3574 | } |
3575 | if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) { |
3576 | $email = $id_or_email->comment_author_email; |
3577 | } |
3578 | } |
Line | Code |
3621 |
|
3622 | /** |
3623 | * Filter the avatar data. |
3624 | * |
3625 | * @since 4.2.0 |
3626 | * |
3627 | * @param array $args Arguments passed to get_avatar_data(), after processing. |
3628 | * @param int|object|string $id_or_email A user ID, email address, or comment object. |
3629 | */ |
3630 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
3631 | } |
3632 |
|