14+ years building on WordPress / Replies in under 5 hours
WordPress 7 min read · Updated July 2026

How to Remove Avatars from WordPress Blog Comments (3 Methods)

Photo of Ajay Khandal
Ajay Khandal
WordPress Developer
TL;DR

WordPress loads a Gravatar image from an external server for every comment — 50 comments means 50 external HTTP requests on every page view. Three fixes: (1) disable all avatars in Settings → Discussion (30 seconds, no code); (2) use a functions.php filter to remove only comment-section avatars while keeping the author avatar; (3) add loading="lazy" to all avatar images so they only load when scrolled into view. Most blogs: Method 2 is the right balance. After applying, verify with the browser Network tab — search for 'gravatar' to confirm no external requests are firing.

Every comment on a WordPress blog post loads a Gravatar image from Gravatar’s servers. That’s an external DNS lookup, an external HTTP request, and an image download for each commenter — and those requests happen in parallel before your page finishes loading. A post with 50 comments makes 50 Gravatar requests on every page view. At scale, this is a measurable page speed problem.

There are three ways to fix it, depending on how much you want to remove versus optimise. This guide covers all three, plus how to verify the fix worked.

Why WordPress Comment Avatars Hurt Page Speed

WordPress uses Gravatar (Globally Recognised Avatar) as its default avatar service. When a user comments on your post, WordPress generates an <img> tag pointing to https://secure.gravatar.com/avatar/[md5-hash-of-email]. The browser then has to:

  1. Resolve the DNS for secure.gravatar.com (one-time, but still a lookup)
  2. Open an HTTPS connection to Gravatar’s CDN
  3. Download the avatar image (typically 48×48px to 96×96px)

Modern HTTP/2 multiplexes these requests over a single connection, which reduces the overhead compared to HTTP/1.1 — but you’re still making external requests to a third-party server you don’t control. If Gravatar’s CDN is slow, or down, or rate-limited, that’s browser time wasted waiting for images that have nothing to do with your content.

For blogs with active comment sections — more than 20 or 30 comments — Gravatar requests are a genuine contributor to slower Largest Contentful Paint (LCP) and Time to Interactive (TTI). For posts with hundreds of comments, it becomes significant. For posts with five comments, there are bigger fish to fry. The right fix depends on how active your comment section actually is.

Method 1: Disable All Avatars via WordPress Settings

The simplest option. No code required, and it takes about 30 seconds:

  1. In your WordPress admin dashboard, go to Settings → Discussion
  2. Scroll to the Avatars section
  3. Uncheck Show Avatars
  4. Click Save Changes

This disables all avatar output sitewide — comment avatars, author avatars, author bio avatars, everywhere. WordPress stops calling the Gravatar API entirely. No Gravatar images are loaded, no Gravatar requests are made.

When to use this: If you don’t display author avatars anywhere prominent on your site, or if you’re happy to remove them entirely for the performance gain, this is the right call. It’s the most complete fix.

Drawback: It removes the author avatar in your post byline and author bio section as well. If your theme shows an author photo in the post header — common on publication-style themes — this will blank it out. Check your theme before applying this sitewide.

Method 2: Remove Comment Avatars Only, Keep the Author Avatar

The original reason this article exists. If you want to keep the author avatar in your post byline or bio but strip avatars from the comment list, WordPress’s get_avatar filter gives you a clean hook to do it.

Add the following to your theme’s functions.php file (or a site-specific plugin if you want to keep it theme-independent):

/**
 * Remove avatars from the comment list only.
 * The author avatar in bylines/bios is unaffected.
 */
function ajk_remove_comment_avatars( $avatar ) {
    global $in_comment_loop;
    return $in_comment_loop ? '' : $avatar;
}
add_filter( 'get_avatar', 'ajk_remove_comment_avatars' );

How this works: WordPress sets the $in_comment_loop global to true while iterating over the comments list (inside wp_list_comments()). The filter checks that flag. If we’re inside the comment loop, return an empty string — no avatar rendered, no Gravatar request made. Outside the comment loop (author byline, bio box), the filter passes through the original $avatar value unchanged.

Where to add this code: The safest place is a child theme’s functions.php, so it survives parent theme updates. If you’re using a parent theme directly and don’t want to create a child theme, a minimal site-specific plugin also works — create a file in wp-content/plugins/ with a plugin header comment and add the function there.

What this does not do: This approach stops WordPress from rendering the avatar <img> tag inside comments. Since the tag is never output, the browser never makes the Gravatar request. The Gravatar API is not called at all for comment avatars when this filter is active.

Method 3: Lazy-Load Comment Avatars

If you want to keep avatars visible but prevent them from blocking initial page load, lazy-loading is the modern approach. Browsers support the native loading="lazy" attribute on <img> tags — images below the fold don’t load until the user scrolls toward them.

WordPress’s get_avatar filter passes the full rendered <img> HTML as a string. You can add the loading attribute by patching it:

/**
 * Add native lazy-loading to all WordPress avatar images.
 */
function ajk_lazy_load_avatars( $avatar ) {
    return str_replace( ' src=', ' loading="lazy" src=', $avatar );
}
add_filter( 'get_avatar', 'ajk_lazy_load_avatars' );

This patches every avatar <img> tag sitewide — comments, author bios, everywhere — to include loading="lazy". Avatars above the fold (typically the author avatar in the byline) still load immediately because they’re in the viewport. Avatars in the comment section, which is usually further down the page, defer until the user scrolls toward them.

Core Web Vitals impact: Lazy-loading below-fold images directly reduces the initial page weight the browser has to handle before the Largest Contentful Paint event. For comment-heavy posts, this is a meaningful LCP and TTI improvement without removing avatars entirely.

Browser support: loading="lazy" is supported in all modern browsers (Chrome, Firefox, Safari, Edge). Older browsers that don’t support it simply ignore the attribute and load images normally — graceful degradation, no JavaScript required.

Note: You can combine Methods 2 and 3 if you want lazy-loaded author avatars but no comment avatars at all — run both filters, with Method 2’s $in_comment_loop check removing comments and Method 3’s attribute patch applying to the remaining (non-comment) avatar calls.

Verifying the Fix

After applying any of these methods, confirm the Gravatar requests are actually gone:

Browser DevTools

  1. Open the post in a browser and open DevTools (F12 or Cmd+Option+I)
  2. Go to the Network tab and reload the page
  3. Filter by Img or search for gravatar in the filter box
  4. After Method 1 or 2: you should see zero secure.gravatar.com requests
  5. After Method 3: Gravatar requests should appear only after you scroll down to the comment section

PageSpeed Insights

Run the post through PageSpeed Insights before and after. Look for:

  • Reduce unused JavaScript and Eliminate render-blocking resources reports — Gravatar requests won’t appear here, but their removal helps with the baseline numbers
  • Avoid chaining critical requests — Gravatar requests, especially on posts with many comments, can appear here as a chain if they’re loading during the critical render path
  • Overall LCP score: on comment-heavy posts, removing external avatar requests typically improves LCP by 100–500ms depending on network conditions and comment count

Which Method Should You Use?

  • No avatars anywhere: Settings → Discussion → uncheck Show Avatars. Done in 30 seconds, no code.
  • Keep author avatar, remove comment avatars: Method 2 (functions.php filter). The right balance for most blog setups.
  • Keep all avatars, improve performance: Method 3 (lazy-load filter). Best for sites where commenter identity matters — community forums, membership sites, heavily commented news posts.
  • Your site has fewer than 20 comments per post: The performance gain from any of these is marginal. Focus on larger wins first — caching, image compression, hosting choice. See the WordPress post-launch checklist for where avatars sit in the priority order.

Avatars are one piece of WordPress comment performance. While you’re in Settings → Discussion, two other settings are worth checking:

  • Break comments into pages: Under Discussion → Other comment settings, enable “Break comments into pages” and set a threshold (25–50 per page). Loading 200 comments at once is a bigger performance hit than the avatars.
  • Comment spam filtering: Akismet or similar spam filters run server-side, not client-side, so they don’t affect page load time. But reducing the number of spam comments that reach moderation reduces your overall comment count and therefore the number of avatars rendered. See how to stop spam on WordPress forms and comments.

For a full approach to keeping your WordPress site fast and maintained, the complete WordPress maintenance guide covers caching, updates, database cleanup, and performance monitoring as a recurring practice rather than a one-off fix.

Frequently asked questions

WordPress loads avatar images from Gravatar (gravatar.com) by default. Each comment generates a separate HTTP request to Gravatar's external servers — a DNS lookup, HTTPS connection, and image download per commenter. A post with 50 comments triggers 50 external Gravatar requests on every page load. Even with HTTP/2 multiplexing, these external requests add to initial page load time and depend on Gravatar's CDN availability, which is outside your control. On posts with active comment sections, removing or lazy-loading these requests measurably improves Largest Contentful Paint (LCP) and Time to Interactive (TTI).

Use WordPress's get_avatar filter combined with the $in_comment_loop global. WordPress sets $in_comment_loop to true while rendering the comment list, so you can return an empty string only during that loop, leaving all other avatar calls (author bylines, bio boxes) unaffected. Add the filter function to your child theme's functions.php or a site-specific plugin: function ajk_remove_comment_avatars($avatar) { global $in_comment_loop; return $in_comment_loop ? '' : $avatar; } add_filter('get_avatar', 'ajk_remove_comment_avatars');

No. All three methods in this guide require no plugin. The admin toggle (Settings → Discussion → uncheck Show Avatars) is built into WordPress. The selective comment-avatar removal and the lazy-load approach both use the get_avatar filter in functions.php — a few lines of code, no plugin dependency. Plugins like 'No Gravatar' do the same thing but add weight to your plugin stack for functionality that's trivially achievable with native WordPress hooks.

No. The Gravatar service and users' profiles on gravatar.com are completely unaffected. These methods only change what your WordPress site renders — whether it outputs an avatar img tag and whether it makes a Gravatar request. Commenters' Gravatar accounts still exist; their avatars still appear on other sites that use Gravatar. Your site simply stops requesting and displaying them.

Two quick ways: First, open the post in a browser, open DevTools (F12), go to the Network tab, reload, and filter by 'gravatar' — after applying Method 1 or 2, you should see zero results. Second, run the post URL through PageSpeed Insights (pagespeed.web.dev) before and after. On posts with 30+ comments, removing Gravatar requests typically improves LCP by 100–500ms depending on network conditions and comment count. The improvement is more visible on mobile, where network latency amplifies external request overhead.

Yes, when the comment section is below the fold (which it usually is). Native lazy-loading (loading="lazy" on img tags) defers image downloads until the image is near the viewport. This reduces the number of resources the browser fetches during the critical render path, directly improving Largest Contentful Paint (LCP) and reducing total blocking time. All modern browsers support loading="lazy" natively — no JavaScript required, and browsers that don't support it simply ignore the attribute. For the LCP element specifically (usually the hero image or featured image, not an avatar), lazy-loading those would hurt rather than help — the benefit here is specifically for below-fold comment avatars.

Photo of Ajay Khandal

Written by Ajay Khandal

I'm a freelance WordPress developer with 14+ years of experience building, fixing, and speeding up sites for businesses, agencies, and store owners across the US, UK, Europe, and Australia. I specialize in custom themes, WooCommerce, and performance — the kind of work that shows up as faster load times and fewer support tickets. No account managers, no outsourced tickets — you work directly with me, with replies typically inside 5 hours.

Work with me →