I’m trying to upload a custom Gravatar to WordPress, however something is breaking the image link and I’m not sure how to fix it.
add_filter( 'avatar_defaults', 'new_default_avatar' );
function new_default_avatar ( $avatar_defaults ) {
//Set the URL where the image file for your avatar is located
$new_avatar_url = get_bloginfo( 'template_directory' ) . '/img/icons/avatar.jpg';
//Set the text that will appear to the right of your avatar in Settings>>Discussion
$avatar_defaults[$new_avatar_url] = 'New Default Gravatar';
return $avatar_defaults;
}
The code works, because I get a radio button with the option to add the Gravatar. The only thing that is broken is the actual image.
When I right click on the image I get this URL:
http://i2.wp.com/localhost/wordpress/wp-content/themes/blog-theme/img/icons/avatar.jpg
I’m not sure where i2.wp.com is coming from, or what it’s doing. When I remove that and do
loalhost:888/wordpress/wp-content/themes/blog-theme/img/icons/avatar.jpg
I can see the Gravatar image.
When I googled this, I saw a lot of people have this problem because of the Jetpack and Photon plugins, but I do not have any plugins installed.