Performance & Security

How to Disable Gravatar in WordPress Without a Plugin

Every time a comment appears on your WordPress site, the commenter’s avatar probably comes from Gravatar, a service owned by Automattic that serves profile pictures based on email addresses. You never asked for that connection, yet your site makes a request to gravatar.com on every page that shows a comment or an author box. That request leaks your visitors’ email hashes to a third party, slows the page down, and adds an external dependency you do not control.

The good news is that you can disable Gravatar in WordPress without a plugin, and it takes less than a minute for the basic version. This guide covers the settings method first, then a code snippet that blocks Gravatar requests completely and replaces avatars with local images, and finally the local avatar alternative for sites that still want profile pictures. It also explains what changes and what does not, so you do not disable something you actually needed.

What Is Gravatar and Why Does WordPress Use It?

Gravatar stands for Globally Recognized Avatar. When someone creates a Gravatar account and uploads a picture, that picture follows their email address across every site that supports Gravatar. WordPress has supported it since the early days, because it gave comments a personal touch without forcing every commenter to upload a picture on every site they visited. When a comment is displayed, WordPress takes the commenter’s email address, turns it into an MD5 hash, and asks gravatar.com for the image matching that hash.

That design made sense when WordPress was mostly a blogging platform, but it has two problems today. The first is privacy. The email hash sent to Gravatar is a stable identifier, and anyone who knows an email address can check whether it has a Gravatar profile, and in some cases recover the profile information attached to it. The second is performance. Every avatar is an external request to a server you do not control, and on a page with twenty comments, that is twenty extra requests plus DNS lookups. The official get_avatar documentation shows how WordPress builds these avatar URLs if you want to see the mechanism for yourself.

Why Would You Disable Gravatar?

Privacy is the strongest reason. Under privacy rules such as the GDPR, sending visitor data to a third party service needs a legal basis and a mention in your privacy policy. Many site owners would rather not send anything to Gravatar at all, especially when their visitors never agreed to it. A commenter who leaves a comment on your blog probably does not expect their email hash to be sent to an Automattic service, and they certainly did not consent to it in any meaningful way. Disabling Gravatar removes that data flow entirely.

Performance is the second reason. External avatar requests add DNS lookups, connections, and downloads that you cannot optimise from your own server. On comment heavy pages, avatars can be a visible part of the page weight. Removing them cuts requests and makes the page render faster, especially for visitors on slow connections. A third reason is design. Gravatar images are unpredictable: some commenters have professional photos, some have cartoons, and some have nothing at all, which leaves a grey mystery person icon next to their name. A site that uses its own consistent default avatar looks more polished. If your site is a business or a store, that consistency matters even more. Our web hosting guide covers the other side of performance, because a fast host plus fewer external requests together make the biggest difference.

Method 1: How Do You Disable Avatars in Settings?

The simplest method needs no code at all. Go to Settings, then Discussion, in your WordPress dashboard. Scroll down to the Avatars section near the bottom of the page. Uncheck the box labelled Show Avatars, then scroll down and click Save Changes. From that moment, WordPress stops displaying avatars anywhere on your site, including comments, author boxes, and the admin bar user menu where it applies. The avatar images disappear and the space they occupied collapses, so your comment layout may tighten up slightly.

This setting stops WordPress from requesting Gravatar images in the places that use the standard avatar functions, which covers almost all themes. It is the right method for most site owners, and it takes seconds. Keep in mind what it does not do. It does not remove the Gravatar related code from WordPress, and a theme or plugin that calls the avatar functions directly with its own settings can still request images. It also does not change anything for users who are logged in and viewing their own profile in the admin area. For a complete block, you need the code method below, which stops the requests at the source rather than only hiding the output.

Method 2: How Do You Block Gravatar Requests With Code?

If you want Gravatar gone completely, a small code snippet is the reliable way. The snippet below replaces every avatar URL with a local default image and removes the DNS prefetch hint that WordPress adds for gravatar.com. Add it with the Code Snippets plugin or in your child theme functions.php file, and set it to run on the front end only. If you have not used code snippets before, our guide to customize the WordPress login page without a plugin shows the same safe workflow for adding PHP without editing theme files directly.

add_filter( 'get_avatar_url', 'vutg_local_avatar_url', 10, 3 );
function vutg_local_avatar_url( $url, $id_or_email, $args ) {
    return get_site_url() . '/wp-content/uploads/default-avatar.png';
}

add_filter( 'wp_resource_hints', 'vutg_remove_gravatar_prefetch', 10, 2 );
function vutg_remove_gravatar_prefetch( $urls, $relation_type ) {
    if ( 'dns-prefetch' === $relation_type ) {
        $urls = array_filter( $urls, function( $url ) {
            return false === strpos( $url, 'gravatar.com' );
        } );
    }
    return $urls;
}

Before you save the snippet, upload your chosen default avatar image to the Media Library and note its URL, then replace the path in the code with your own image URL. A simple image of a person silhouette, your logo mark, or a neutral initial works well. The image should be square, around 96 by 96 pixels or larger, and under 20 kilobytes so it loads fast. After saving, visit a post with comments and check that every avatar now shows your local image and that no request to gravatar.com appears in the browser network tab. You can also keep the Show Avatars setting enabled with this snippet active, because the snippet controls what image is served, while the setting controls whether avatars show at all. If you want no avatars whatsoever, uncheck Show Avatars as well and the snippet becomes a safety net for any theme or plugin that ignores the setting.

A related filter worth knowing about is the avatar defaults filter, which changes the image WordPress uses when no Gravatar exists for an email address. That is a different job from disabling Gravatar, and we cover it in our guide to change the default avatar in WordPress without a plugin. Disabling Gravatar stops the external request, while changing the default avatar only changes the fallback image. If privacy is your goal, disabling is the correct choice.

Method 3: What Is the Local Avatar Alternative?

Some sites want to keep profile pictures but host them locally. That is a fair middle ground: your users and commenters still get recognisable avatars, but no data leaves your site. For logged in users, WordPress now lets each user upload their own profile picture from their profile page in the admin area, and that picture is stored in your own Media Library. Encourage your registered users to upload a picture there instead of relying on Gravatar. For commenters who are not registered, there is no built in local upload, so they will all share the same default image you chose in Method 2. That is a reasonable trade, because anonymous commenters do not expect a personal picture on your site.

If you run a membership site or a community where avatars matter, a dedicated local avatar feature may be worth building, but for a normal blog or business site, a single clean default avatar is enough. Keep the image consistent with your brand, and avoid using a photo of a real person as the default, because visitors may mistake it for a real commenter. A simple geometric design or a silhouette in your brand colour is the safest choice. Also review your comment settings while you are here, because avatar privacy is only one part of comment security, and our guide to disable XML-RPC in WordPress covers another external access point worth closing.

What Breaks When You Disable Gravatar?

Very little breaks, which is why this is a low risk change. Comments still work exactly as before, with the same names, dates, and text, only the pictures change. The block editor is unaffected, because it does not depend on Gravatar for editing. The admin area still shows user avatars in the users list when the setting is on, but those come from the same filter, so your local default applies there too. The one visible change is that commenters who were proud of their Gravatar picture will now see the generic default instead. If your site is a community where people recognise each other by their Gravatar, warn your regulars first or use the local avatar method so they can upload a picture on your site.

One thing that does not change is the user profile picture in the WordPress admin bar for logged in users. If you disable avatars and a logged in user still sees their Gravatar in the admin area, that is because the admin bar uses a separate code path in some setups, and the code snippet in Method 2 covers the standard functions. Clear your cache after making the change, because cached pages will keep showing the old Gravatar images until the cache expires. Also check your site with the browser developer tools open on the Network tab and filter for gravatar to confirm no requests remain. If you still see requests, a plugin is loading them directly, so deactivate plugins one at a time to find it. A slow admin area has many possible causes, and our guide to fix a slow WordPress admin dashboard helps you track down the rest.

Frequently Asked Questions

Does disabling Gravatar improve page speed?

Yes, on pages with comments. Each avatar is an external request to gravatar.com, with a DNS lookup and a download. Removing those requests cuts page weight and render blocking work, and the gain is largest on posts with many comments.

Will disabling Gravatar delete my users profile pictures?

No. Gravatar pictures are not stored on your site, so there is nothing to delete. Disabling Gravatar only stops your site from requesting them. Profile pictures uploaded to your own Media Library stay exactly where they are.

Is disabling Gravatar enough for GDPR compliance?

It removes one data flow, which helps, but GDPR compliance depends on your whole site, including analytics, embeds, and forms. Disabling Gravatar is a good step, not a complete compliance solution, so review your other third party services as well.

Can I disable Gravatar but keep a default avatar?

Yes. Keep Show Avatars enabled and use the code snippet in Method 2 to serve a local default image for every user. Visitors still see an avatar next to each comment, but the image comes from your own server instead of gravatar.com.

Last updated: December 2026.

Hostinger - Get 20% OFF

Habib ur Rehman

Hello! I'm the founder of VU Tech Geek. As a BSCS graduate and experienced WordPress professional, I'm passionate about technology and education. My Virtual University journey has given me valuable insights and knowledge, which I love to share with fellow students.… More »

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker