I can't manage to get the code working to show my default gravatar image for my child wordpress theme.
This is the code I am using:
//Custom Gravatar
add_filter( 'avatar_defaults', 'new_custom_default_gravatar' );
function new_custom_default_gravatar ($avatar_defaults) {
$myavatar = get_stylesheet_directory_uri() . '/gravatar/favicon.png';
$avatar_defaults[$myavatar] = "My Custom Gravatar";
return $avatar_defaults;
}
I do see the clickable option on the backend settings. This is what I get when I inspect the section:
<label>
<input type="radio" name="avatar_default" id="avatar_http://mysubdomain.mydomain.org/wordpress/wp-content/themes/my-theme-child-theme/gravatar/favicon.png" value="http://mysubdomain.mydomain.org/wordpress/wp-content/themes/my-theme-child-theme/gravatar/favicon.png">
<img alt="" src="http://1.gravatar.com/avatar/419a9e4a2c6ea719fd7d300cbd38e24d?s=32&d=http%3A%2F%2Fmysubdomain.mydomain.org%2Fwordpress%2Fwp-content%2Fthemes%2Fmy-theme-child-theme%2Fgravatar%2Ffavicon.png&r=g&forcedefault=1" srcset="http://1.gravatar.com/avatar/419a9e4a2c6ea719fd7d300cbd38e24d?s=64&d=http%3A%2F%2Fmysubdomain.mydomain.org%2Fwordpress%2Fwp-content%2Fthemes%2Fmy-theme-child-theme%2Fgravatar%2Ffavicon.png&r=g&forcedefault=1 2x" class="avatar avatar-32 photo" height="32" width="32"> My Custom Gravatar
</label>
If I visit the image link I get a redirect to:
http://i0.wp.com/2Fmysubdomain.mydomain.org/wordpress/wp-content/themes/my-theme-child-theme/gravatar/favicon.png
With the message:
We cannot complete this request, remote data was invalid
My folder and file permissions are 777. Any ideas?
This problem is known, here is some description:
https://en.gravatar.com/site/implement/images/
So this is a duplicate of https://wordpress.stackexchange.com/questions/159482/custom-gravatar-not-working