Can’t change default Gravatar image
-
Hi there,
I am trying to change the default gravatar image to one of my own, but can’t seem to do it.
I have tried the following code:
add_filter( 'avatar_defaults', 'new_custom_default_gravatar' );
function new_custom_default_gravatar ($avatar_defaults) {
$myavatar = get_stylesheet_directory_uri() . '/images/profile-user-avatar.svg';
$avatar_defaults[$myavatar] = "Custom Default Gravatar";
return $avatar_defaults;
}However, on the frontend, the URL is showing as:
https://secure.gravatar.com/avatar/ea508982d1b0cad196bed52e87dacc2d?s=32&d=https%3A%2F%2Fwww.mywebsite.co.uk%2Fwp-content%2Fthemes%2Fmy-listing-child%2Fimages%2Fprofile-user-avatar.svg&f=y&r=g
Any ideas what I am doing wrong?
I’ve even tried an absolute URL and it still outputs a strange URL.
Any suggestions would be great.
Thanks
- The topic ‘Can’t change default Gravatar image’ is closed to new replies.