thanks i try something like this
function my_custom_avatar($avatar, $id_or_email, $size, $default, $alt) {
// Get user ID if email or object is provided
if (is_numeric($id_or_email)) {
$user_id = $id_or_email;
} elseif (is_object($id_or_email)) {
// For objects like WP_Comment
$user_id = $id_or_email->user_id;
} else {
$user = get_user_by('email', $id_or_email);
$user_id = $user ? $user->ID : null;
}
// Retrieve custom avatar from user meta (with correct meta_key)
if ($user_id) {
$custom_avatar = get_user_meta($user_id, 'Custom_User_avatar', true);
}
// If a custom avatar is available, return it directly
if (!empty($custom_avatar)) {
$avatar = "<img alt='{$alt}' src='" . esc_url($custom_avatar) . "' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
}
return $avatar;
}
add_filter('get_avatar', 'my_custom_avatar', 10, 5);
but beacuse i have the Comments and Users Cache on if a user have make a comment and after change the avatar its still show the old is this normal??