How to Remove in Default Avatar in WordPress

Reading Time: < 1 minutes

Recently, I am working on getting my custom default avatar for WordPress Theme, however, the situation is, I am working in a local environment, and keeps on getting as a prefix on my image URL.

For example, if I have:


WordPress will immediately add, which I do not have any idea why, I have:

As part of isolation, I tried to disable all plugins to ensure no unwanted behavior on my working environment, and still failed. In fact, no Jetpack plugin on my working environment.

I almost give up and took a quick break for 5 mins.

Thanks to issue lie on my image that is not accessible online, which I have no idea this will matter

Here are the details below:

When you include a default image, Gravatar will automatically serve up that image if there is no image associated with the requested email hash. There are a > few conditions which must be met for default image URL:

MUST be publicly available (e.g. cannot be on an intranet, on a local development machine, behind HTTP Author some other firewall etc). Default images are passed through a security scan to avoid malicious content.

MUST be accessible via HTTP or HTTPS on the standard ports, 80 and 443, respectively.

MUST have a recognizable image extension (jpg, jpeg, gif, png)

MUST NOT include a querystring (if it does, it will be ignored)


Finally, I made it work. The test image provided was:

Complete code:

function default_gravatar ($avatar_defaults) {
	$avatar = '';
	$avatar_defaults[$avatar] = "Default Gravatar";
	return $avatar_defaults;
add_filter('avatar_defaults', 'default_gravatar ' );

I hope this will help you out in someways.

Was this post helpful?

This Post Has 2 Comments

  1. Frank

    Unfortunately, that doesn’t help anymore.

    By default, it is now redirected via *,
    but your hack just changes it to use * instead.

    OK, it’s a bit better, but I would really like it without any diversion.
    I would like it if there wasn’t any external tracking at all.

  2. Liked

    I tried it, but sadly it’s not working anymore.

Leave a Reply