Fonts & Third-Party

How to Speed Up WordPress Comments (Gravatar and Lazy Loading)

If your posts load slowly, the comments section is probably the last place you look. That is a mistake. On a popular post, the comment thread can quietly add dozens of extra requests, pull in images from a third-party server, and inflate the page weight long after the article itself has finished loading. The post feels fast when you test it with comments closed, and sluggish when real readers show up. This guide fixes that, step by step, without killing the conversation that makes your site worth visiting.

Why Comments Slow Down a Post

Every visible comment adds work to the page. The biggest cost is usually Gravatar, the avatar service WordPress uses by default. Each commenter’s avatar is a separate image request to Gravatar’s servers, and a thread with fifty comments means fifty extra images before the page is fully done. Those requests are small individually, but they add up in connection overhead, and because they come from a domain you do not control, you cannot cache them the way you cache your own images.

Then there is the markup itself. Long threads mean long HTML: nested replies, reply links, author links, timestamps, and comment text, all rendered on every page view. Add a spam-filtering plugin, a comment-form enhancement, or a social login button, and you have extra scripts and database queries layered on top. None of this is dramatic on its own. Together, on a post with a hundred comments, it can be the difference between a page that feels instant and one that visibly drags.

The good news is that almost all of this cost is optional. Readers do not need every avatar and every comment loaded the instant the page opens. They need the article first, and the conversation when they scroll to it.

Step 1: Measure Before You Change Anything

Do not guess at the problem. Open one of your busiest commented posts in PageSpeed Insights or WebPageTest and look at the request list, not just the headline score. Filter for requests to gravatar.com and count them. Note how many requests the page makes in total, and how much of the page weight sits below the fold in the comment area.

Then open the same post with comments hidden — most caching plugins let you preview, or you can temporarily view a post with few comments — and compare. If the commented version makes visibly more requests and loads more slowly, you have confirmed the diagnosis and you have a baseline to measure your fixes against. Write the numbers down. Optimization without a baseline is just rearranging furniture.

For a refresher on reading these results properly, see our guide on how to test your WordPress site speed the right way.

Step 2: Tame Gravatars

Gravatars are the single biggest comment cost, so start here. You have four levers, and you can combine them.

First, shrink the avatars. In Settings, then Discussion, WordPress lets you set the default avatar size. Many themes request avatars larger than they display. If your theme shows 48-pixel avatars, there is no reason to load 96-pixel ones. Check what your theme actually renders, then match the size to it.

Second, pick a cheap default avatar. When a commenter has no Gravatar, WordPress falls back to a default image, and some defaults are generated on the fly. Choose a simple static default, such as Blank or a custom image hosted on your own site, instead of a generated pattern. A static image can be cached; a generated one often cannot.

Third, consider disabling avatars entirely on high-traffic posts if your community does not depend on them. The checkbox is in Settings, then Discussion, under Avatars. This is the nuclear option and it works, but it also makes threads harder to scan, so treat it as a last resort rather than a first move.

Fourth, serve avatars locally. Plugins exist that cache Gravatar images on your own server or CDN, which turns dozens of third-party requests into same-domain requests you control and can cache. This is the best of both worlds for sites that want to keep avatars: the visual identity stays, but the third-party penalty goes away. Test carefully after enabling this, because a stale local avatar cache can show old profile pictures, and you want to confirm the plugin purges sensibly.

Step 3: Lazy Load the Comments Section

This is the highest-impact change for most sites, and it follows the same logic as lazy loading images: do not load something until the reader is about to see it. Our complete guide to lazy loading images covers the underlying principle in detail.

For comments, you have three practical routes:

The plugin route. Dedicated lazy-load-comments plugins defer the entire comment list until the reader scrolls near it, or replace it with a “Load Comments” button. This is the simplest option and the one most site owners should start with. Install it, check that the button or scroll trigger works on mobile as well as desktop, and confirm that comment counts and reply links still function.

The load-on-click route. Some plugins and themes offer a button that loads comments only when clicked. This is even lighter than scroll-based lazy loading, because readers who never open the thread cost you nothing at all. It is a good fit for posts where most visitors read and leave without engaging.

The code route. If you are comfortable editing your theme, you can wrap the comments template in a container and load it via JavaScript when it enters the viewport, using an IntersectionObserver. This gives you full control over the trigger and the loading indicator, but it is custom code you own and maintain, so only take this route if you are comfortable debugging it after theme updates.

One caution: test lazy loading with your caching plugin active. Some page caches capture the pre-JavaScript state of the page, and a misconfigured cache can serve a page where comments never load. Clear the cache after setup and test in a private browser window, logged out, before calling the job done.

Step 4: Paginate Long Threads

WordPress has a built-in feature that many site owners never touch: comment pagination. In Settings, then Discussion, check “Break comments into pages” and set a sensible number per page, typically 20 to 50. Older comments appear on earlier pages, and only one page of comments loads at a time.

This is not just a performance fix. It is a usability fix too. Nobody enjoys scrolling through three hundred comments to find the reply box, and search engines prefer pages that are not bloated with endless markup. A thread of 200 comments split into pages of 50 loads roughly a quarter of the avatar requests and markup on the first view, and every subsequent page is just as light.

Pair pagination with a sensible default sort order. Showing the newest comments first usually matches what returning readers want, and it avoids the odd experience of landing on page one of a years-old argument.

Step 5: Cut the Hidden Costs Around Comments

With avatars and loading sorted, sweep up the smaller costs that hide around the comment form.

Close comments on old posts. WordPress lets you automatically close comments on articles older than a set number of days, in Settings, then Discussion. Old posts attract the most spam and the least genuine discussion, so closing them after, say, 60 or 90 days cuts spam-filtering work and database writes with almost no downside. You can always reopen comments on a specific post if a conversation revives.

Disable pingbacks and trackbacks. These are legacy notification mechanisms that mostly generate spam these days, and each one is a request your server has to process. Uncheck “Allow link notifications from other blogs” in Settings, then Discussion. Genuine readers comment directly; nobody will miss pingbacks.

Audit your anti-spam setup. A spam filter that runs heavy checks on every page view is worse than one that only runs when a comment is submitted. If your spam plugin loads scripts on every page, look for a setting to restrict it to comment forms, or switch to a lighter option. Spam is also database bloat: thousands of spam comments sitting in the trash still cost queries, so empty the spam queue regularly as part of your normal database cleanup routine.

Check the comment form itself. Social login buttons, rich-text editors, and subscription checkboxes each add scripts. Keep the form close to default unless a feature earns its weight in actual use. If a feature sounded good when you installed it but nobody uses it, remove it.

Step 6: Make Sure Caching and Comments Get Along

Caching plugins sometimes treat commented pages awkwardly, because a page with a comment form is technically different for every visitor. The usual result is that commented pages are served uncached, or cached with stale comment counts.

First, confirm your caching plugin is actually caching your busiest commented posts. Check the response headers or use a logged-out browser test. If commented pages bypass the cache entirely, look for the plugin’s setting for caching pages with comments, or for excluding only the comment form from the cache rather than the whole page.

Second, remember that lazy-loaded comments and page caching work well together precisely because the cached HTML is light: the heavy comment content arrives later, via a separate request, after the fast cached shell has painted. This is the same pattern that makes lazy loading images so effective, and it is why steps 3 and 6 reinforce each other.

Finally, watch your server background load. Comment activity triggers admin-ajax requests, notification emails, and moderation queues. If comment spam or notification storms are hammering your server, the fixes in our guide to reducing server load — taming background requests and moving scheduled work to a real cron job — apply here too.

What Not to Do

Do not disable comments site-wide just for speed. If your readers comment, that engagement is worth more than the milliseconds you save, and there are lighter ways to get those milliseconds back, as this guide shows.

Do not lazy load comments that sit above the fold. On most sites comments live at the bottom of the post, so this rarely matters, but if your theme places a comment preview near the top, lazy loading it can delay content readers actually see and hurt your Largest Contentful Paint.

Do not stack three comment plugins that do the same job. A lazy-load plugin plus a separate avatar plugin plus a comment-enhancement plugin can easily cost more than the original problem. Pick one tool per job, measure after each change, and remove anything that does not earn its place.

The Checklist

To sum up: measure a commented post against a baseline, shrink or locally cache Gravatars, lazy load the comment thread or load it on click, paginate threads at 20 to 50 comments per page, close comments on old posts, disable pingbacks, audit your spam plugin’s footprint, and verify your cache still serves commented pages quickly. Work through that list on your five busiest posts first, then roll the same settings out site-wide.

Comments are one of the few performance problems where the fix also improves the experience: readers get the article faster, and the conversation is still there, intact, the moment they scroll down to join it.

Leave a Reply

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