How to Lazy Load WordPress Comments

Disclosure: This post may contain affiliate links. Purchasing a product through one of these links generates a commission for us at no additional expense to you.

There are dozens of ways to speed up WordPress.

Lazy loading is an especially popular technique often used to delay loading images until they appear on the screen. When implemented properly with a plugin like Optimole, it can make a tremendous difference in load times.

But hardly anyone thinks to lazy load their comments.

Lazy loading your WordPress comments can give your posts a nice performance boost, and it’s incredibly easy to implement.

Why you should lazy load comments

The main benefit of lazy loading comments is to reduce the performance cost of Gravatar.

Imagine your site has 7 comments on it and each author has their own Gravatar account. That means that your site will make 7 HTTP requests to the Gravatar website to fetch each of those images.

While Gravatar is a well-optimized service, external requests can be expensive and posts with large numbers of comments can really suffer.

Most ways of optimizing Gravatar requests are complex and prone to errors. An elegant solution is to lazy load the comments section so that there are no Gravatar requests until the visitor reaches the comments section.

How to lazy load comments

The best part about this optimization is that it’s incredibly simple to implement.

To get started, install the Lazy Load for Comments plugin.

Lazy Load Comments Plugin

Once installed on your site, the settings can be tough to find. That’s because Lazy Load for Comments only adds one option which you can find here within the Discussion settings:

Lazy Load Comments Setting

You can set it to:

  • On Scroll
  • On Click
  • No Lazy Load

On this website, I’ve set the plugin to “On Scroll” which means that the comments won’t load until the visitor has scrolled the comments section into view.

The alternative option is “On Click” which will replace the normal comments section with a button. The comments won’t load until the visitor clicks the “Load comments” button.

Keep optimizing

How easy was that?

Thanks to an awesome (and free) plugin, making comments lazy load in WordPress is extremely easy. If you’re looking for a way to get an extra edge in the search engines, don’t skip out on this quick win.

If you want to keep optimizing your site, visit the performance optimization category to find tons more articles on speeding up WordPress

View the latest speed optimization posts →

If this post helped you out today then please consider sharing it before you leave.

Ben Sibley
Ben Sibley
Ben Sibley is a WordPress theme designer & developer, and founder of Compete Themes.