I use the get_avatar_url() to retrieve the default gravatar image of an user.
get_avatar_url( $user_id );
In case there is non I will provide and default using the arguments array.
$arg = array (
'default' => get_home_url() . '/wp-content/uploads/.../profile_image_0.jpg',
);
$avatar = get_avatar_url( $user_id , $arg );
This is working fine until I need to replace the image. The problem is that the "" service is caching the image.
So the question is how to reset or exchange the image without changing the filename?
I use the get_avatar_url() to retrieve the default gravatar image of an user.
get_avatar_url( $user_id );
In case there is non I will provide and default using the arguments array.
$arg = array (
'default' => get_home_url() . '/wp-content/uploads/.../profile_image_0.jpg',
);
$avatar = get_avatar_url( $user_id , $arg );
This is working fine until I need to replace the image. The problem is that the "https://i1.wp.com" service is caching the image.
So the question is how to reset or exchange the image without changing the filename?
Paste below code in function.php file
function theme_custom_avatar_url($url, $idOrEmail, $args){
return get_home_url() . '/wp-content/uploads/.../profile_image_0.jpg';
}
add_filter('get_avatar_url', 'theme_custom_avatar_url', 10, 3);