Filter hook 'get_avatar_url'

in WP Core File wp-includes/link-template.php at line 4571

View Source

get_avatar_url

Filter Hook
Description
Filters the avatar URL.

Hook Information

File Location wp-includes/link-template.php View on GitHub
Hook Type Filter
Line Number 4571

Hook Parameters

Type Name Description
string $url The URL of the avatar.
mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar SHA-256 or MD5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.
array $args Arguments passed to get_avatar_data(), after processing.

Usage Examples

Basic Usage
<?php
// Hook into get_avatar_url
add_filter('get_avatar_url', 'my_custom_filter', 10, 3);

function my_custom_filter($url, $id_or_email, $args) {
    // Your custom filtering logic here
    return $url;
}

Source Code Context

wp-includes/link-template.php:4571 - How this hook is used in WordPress core
<?php
4566  	 * @param string $url         The URL of the avatar.
4567  	 * @param mixed  $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar SHA-256 or MD5 hash,
4568  	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
4569  	 * @param array  $args        Arguments passed to get_avatar_data(), after processing.
4570  	 */
4571  	$args['url'] = apply_filters( 'get_avatar_url', $url, $id_or_email, $args );
4572  
4573  	/**
4574  	 * Filters the avatar data.
4575  	 *
4576  	 * @since 4.2.0

PHP Documentation

<?php
/**
	 * Filters the avatar URL.
	 *
	 * @since 4.2.0
	 *
	 * @param string $url         The URL of the avatar.
	 * @param mixed  $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar SHA-256 or MD5 hash,
	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
	 * @param array  $args        Arguments passed to get_avatar_data(), after processing.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.