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 |
|---|---|
| 4186 | * |
| 4187 | * @param array $args Arguments passed to get_avatar_data(), after processing. |
| 4188 | * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user ID, Gravatar MD5 hash, |
| 4189 | * user email, WP_User object, WP_Post object, or WP_Comment object. |
| 4190 | */ |
| 4191 | $args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email ); |
| 4192 | |
| 4193 | if ( isset( $args['url'] ) ) { |
| 4194 | /** This filter is documented in wp-includes/link-template.php */ |
| 4195 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
| 4196 | } |
| 4197 | |
| 4198 | $email_hash = ''; |
| 4199 | $user = false; |
| 4200 | $email = false; |
| 4201 | |
| 4202 | if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) { |
| 4203 | $id_or_email = get_comment( $id_or_email ); |
| 4204 | } |
| Line | Code |
| 4218 | // User object. |
| 4219 | $user = $id_or_email; |
| 4220 | } elseif ( $id_or_email instanceof WP_Post ) { |
| 4221 | // Post object. |
| 4222 | $user = get_user_by( 'id', (int) $id_or_email->post_author ); |
| 4223 | } elseif ( $id_or_email instanceof WP_Comment ) { |
| 4224 | if ( ! is_avatar_comment_type( get_comment_type( $id_or_email ) ) ) { |
| 4225 | $args['url'] = false; |
| 4226 | /** This filter is documented in wp-includes/link-template.php */ |
| 4227 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
| 4228 | } |
| 4229 | |
| 4230 | if ( ! empty( $id_or_email->user_id ) ) { |
| 4231 | $user = get_user_by( 'id', (int) $id_or_email->user_id ); |
| 4232 | } |
| 4233 | if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) { |
| 4234 | $email = $id_or_email->comment_author_email; |
| 4235 | } |
| 4236 | } |
| Line | Code |
| 4285 | /** |
| 4286 | * Filters the avatar data. |
| 4287 | * |
| 4288 | * @since 4.2.0 |
| 4289 | * |
| 4290 | * @param array $args Arguments passed to get_avatar_data(), after processing. |
| 4291 | * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user ID, Gravatar MD5 hash, |
| 4292 | * user email, WP_User object, WP_Post object, or WP_Comment object. |
| 4293 | */ |
| 4294 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
| 4295 | } |
| 4296 | |
| 4297 | /** |
| 4298 | * Retrieves the URL of a file in the theme. |
| 4299 | * |
| 4300 | * Searches in the stylesheet directory before the template directory so themes |
| 4301 | * which inherit from a parent theme can just override one file. |
| 4302 | * |
| 4303 | * @since 4.7.0 |