get_avatar хук-фильтрWP 2.5.0

Filters the HTML for a user's avatar.

Использование

add_filter( 'get_avatar', 'wp_kama_get_avatar_filter', 10, 6 );

/**
 * Function for `get_avatar` filter-hook.
 * 
 * @param string $avatar      HTML for the user's avatar.
 * @param mixed  $id_or_email The avatar to retrieve. Accepts a user_id, Gravatar MD5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.
 * @param int    $size        Square avatar width and height in pixels to retrieve.
 * @param string $default     URL for the default image or a default type. Accepts '404', 'retro', 'monsterid', 'wavatar', 'indenticon', 'mystery', 'mm', 'mysteryman', 'blank', or 'gravatar_default'.
 * @param string $alt         Alternative text to use in the avatar image tag.
 * @param array  $args        Arguments passed to get_avatar_data(), after processing.
 *
 * @return string
 */
function wp_kama_get_avatar_filter( $avatar, $id_or_email, $size, $default, $alt, $args ){

	// filter...
	return $avatar;
}
$avatar(строка)
HTML for the user's avatar.
$id_or_email(разное)
The avatar to retrieve. Accepts a user_id, Gravatar MD5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.
$size(int)
Square avatar width and height in pixels to retrieve.
$default(строка)
URL for the default image or a default type. Accepts '404', 'retro', 'monsterid', 'wavatar', 'indenticon', 'mystery', 'mm', 'mysteryman', 'blank', or 'gravatar_default'.
$alt(строка)
Alternative text to use in the avatar image tag.
$args(массив)
Arguments passed to get_avatar_data(), after processing.

Список изменений

С версии 2.5.0 Введена.
С версии 4.2.0 The $args parameter was added.

Где вызывается хук

get_avatar()
get_avatar
wp-includes/pluggable.php 2872
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
wp-includes/pluggable.php 2803
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );

Где используется хук в WordPress

Использование не найдено.