I am developing a theme locally on a local multisite installation and trying to change the default gravitar with the following function:

function custom_gravitar ($avatar_defaults) {
  $myavatar = get_bloginfo('template_directory') . '/img/gravitar.gif';
  $avatar_defaults[$myavatar] = "Custom gravitar";
  return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'custom_gravitar' );

The path that is output is http://i0.wp.com/localhost/my-site-folder/wp-content/themes/my-theme/img/gravitar.gif

but my local url is http://localhost/my-site-folder/

I tried defining the WP_CONTENT_URLconstant but it doesn’t seem to have any impact.

I have also tried $myavatar = get_site_url() . '/img/gravitar.gif'; and various other functions but all of them seem to include the prefix i0.wp.com/
I have used the suggested htaccess change to set up a MultiSite so I don’t see where this is coming from.

How can I get the correct path to my images folder?

Read more here: URL for images folder on Multisite


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: