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 |
---|---|
4247 | * |
4248 | * @param array $args Arguments passed to get_avatar_data(), after processing. |
4249 | * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user ID, Gravatar MD5 hash, |
4250 | * user email, WP_User object, WP_Post object, or WP_Comment object. |
4251 | */ |
4252 | $args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email ); |
4253 |
|
4254 | if ( isset( $args['url'] ) ) { |
4255 | /** This filter is documented in wp-includes/link-template.php */ |
4256 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
4257 | } |
4258 |
|
4259 | $email_hash = ''; |
4260 | $user = false; |
4261 | $email = false; |
4262 |
|
4263 | if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) { |
4264 | $id_or_email = get_comment( $id_or_email ); |
4265 | } |
Line | Code |
4279 | // User object. |
4280 | $user = $id_or_email; |
4281 | } elseif ( $id_or_email instanceof WP_Post ) { |
4282 | // Post object. |
4283 | $user = get_user_by( 'id', (int) $id_or_email->post_author ); |
4284 | } elseif ( $id_or_email instanceof WP_Comment ) { |
4285 | if ( ! is_avatar_comment_type( get_comment_type( $id_or_email ) ) ) { |
4286 | $args['url'] = false; |
4287 | /** This filter is documented in wp-includes/link-template.php */ |
4288 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
4289 | } |
4290 |
|
4291 | if ( ! empty( $id_or_email->user_id ) ) { |
4292 | $user = get_user_by( 'id', (int) $id_or_email->user_id ); |
4293 | } |
4294 | if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) { |
4295 | $email = $id_or_email->comment_author_email; |
4296 | } |
4297 | } |
Line | Code |
4346 | /** |
4347 | * Filters the avatar data. |
4348 | * |
4349 | * @since 4.2.0 |
4350 | * |
4351 | * @param array $args Arguments passed to get_avatar_data(), after processing. |
4352 | * @param mixed $id_or_email The Gravatar to retrieve. Accepts a user ID, Gravatar MD5 hash, |
4353 | * user email, WP_User object, WP_Post object, or WP_Comment object. |
4354 | */ |
4355 | return apply_filters( 'get_avatar_data', $args, $id_or_email ); |
4356 | } |
4357 |
|
4358 | /** |
4359 | * Retrieves the URL of a file in the theme. |
4360 | * |
4361 | * Searches in the stylesheet directory before the template directory so themes |
4362 | * which inherit from a parent theme can just override one file. |
4363 | * |
4364 | * @since 4.7.0 |