Lazy Loading for WordPress: How to Add It to Your Website

Share this article

WordPress lazy loading

This article on lazy loading for WordPress was originally published by Torque Magazine, and is reproduced here with permission.

Adding lazy load to your WordPress website is an effective tool to speed up your WordPress website. We have written extensively (we even made a case study) about how slow page loading speed negatively effects conversions, SEO, and other markers for online success. The faster your site loads, the better.

Two of the most important factors that slow down sites are HTTP requests and page weight. Naturally, the more requests a browser has to send to the server, the longer it will take to process the site. At the same time, the larger your page is (for example, because it contains many images), the longer it will take to load.

Lazy load is a technique that addresses both of these factors. It means delaying a load of some parts of a web page until they are actually needed. It’s also the topic of this blog post. In the following, you will learn how lazy load works, its advantages and disadvantages and as well as ways to add lazy load to WordPress.

I hope you’re not too lazy to keep reading!

What is Lazy Load and What Can You Use It for?

As already mentioned, lazy load is a way of keeping the browser from initially loading parts of web pages – typically images – and replace them with placeholders. That way, the page becomes smaller and less data needs to be transferred from server to browser.

The result: a faster loading website and happier users.

But wait, don’t you need those parts of your site? If you didn’t, they wouldn’t be on there, right? Won’t it mess up the page?

Well, here’s where the lazy in lazy load comes into play. The technique doesn’t simply prohibit browser from loading assets and images but simply delays it until they are actually needed.

For example, an image doesn’t need to be on the page until a visitor scrolls down far enough to actually see it. As a consequence, the browser doesn’t really need to load it until right before that happens. That’s exactly what lazy load does.

(By the way, there are other ways to optimize images on your website to make them load quicker.)

Lazy Load Use Cases

Around the web, lazy load is most often used for images. You have probably seen it on popular sites like Buzzfeed, who use the technique to make their listicles appear more quickly inside their users’ browsers.

And example of Buzzfeed's lazy loading of image

However, that’s not the only thing lazy load is capable of delaying. Other examples are videos, scripts, and comments. In fact, moving JavaScript files to the footer of a page is a common technique to speed up page loading times.

You might also be aware that YouTube only loads comments when you scroll down to them. That way, the platform makes sure that you get to watch your video more quickly. If it’s good enough for them, why not for you?

There’s also a special application of lazy load called infinite scroll. It’s an alternative to classic pagination where additional posts load whenever the user reaches the bottom of a page. You can see it on Pinterest or if you are a user of Pocket.

Pocket's lazy loading and infinite scroll

It eliminates a lot of clicks and can be great for user experience. However, infinite scroll is not without controversy and won’t be the focus of this article.

Advantages of Lazy Load

The main advantage of lazy load is already apparent: faster loading times. When you can shave off a large chunk of your page weight, it will naturally appear in the browser much faster.

A nice side effect of that is that you save your visitors considerable bandwidth. Especially those using the data connection on their mobile device will be thankful. In addition to seeing your site quicker, they also don’t have to waste their plan on images they might never even see.

Disadvantages of Using Lazy Load on Your Site

Yet, using lazy load is not all sunshine and rainbows. The technique also has some disadvantages.

First and foremost, it’s not always search engine friendly. When you delay loading assets for visitors, you do the same for search engine spiders. As a consequence, they might not index some of your content, which is, of course, is not great for SEO. Even if workarounds exist. Naturally, this is a bigger problem when using lazy load for posts and not just images (which is why many stay away from it).

A second concern is user experience. When scrolling down your site very quickly, replacing placeholder images with actual visuals can make page content jump, which can be annoying.

So, what’s the verdict on lazy load? In short: used within limits the technique can make your WordPress site load a lot faster, however, you need to keep an eye out for SEO and user experience.

How to Add Lazy Load to WordPress via Plugin

While it’s possible to add lazy load to WordPress manually (see Jay Hoffmann’s tutorial over at Elegant Themes), the much easier alternative is to use one of the plugins below. Many of the offers listed here are simple set-it-and-forget-it solutions that you only need to activate without any configuration. Most of them also very lightweight.

For that reason, adding lazy load to WordPress without a plugin just seems like an unnecessary effort to me (unless you do it to improve your technical chops, which is a legitimate reason). For most users, it’s better to choose one of the many lazy load plugins the WordPress sphere has to offer.

Lazy Load

Our first candidate is the most popular free solution for lazy loading images out there. It has over 90,000 installs and a solid 4-star rating. Its popularity might be partially explained by the fact that the Automattic team is a contributor to it.

The Lazy Load plugin uses jQuery.sonar for loading images only when they appear in the viewport (which is the part of the site that you see on your device). The unzipped plugin is just 20KB large and all you need to do is install and activate it. No configuration necessary.

BJ Lazy Load

BJ lazyload WordPress plugin

The runner-up to the throne of best lazy load WordPress plugins is BJ Lazy Load. It boasts more than 60,000 installs and similarly good ratings.

The plugin replaces all images and iframes (including YouTube and Vimeo videos) in your content with a placeholder until viewed. Install, activate and you are good to go.

Lazy Load by WP Rocket

LazyLoad WordPress plugin by WP Rocket

Here we have a plugin by the same maker as the popular caching plugin WP Rocket. It can lazy load images and/or iframes including thumbnails, widget content, avatars, and smileys. What’s more, the plugin doesn’t use any JavaScript libraries. That’s probably one of the reasons it weighs less than 10KB.

More than 10,000 websites trust Lazy Load by WP Rocket, so it seems to be doing its job properly. The plugin site in the WordPress directory also contains code to selectively deactivate lazy load on pages or images or change its loading threshold. Otherwise, no configuration options are available.

a3 Lazy Load

A3 Lazy Load WordPress plugin

a3 Lazy Load claims to be the “most fully featured, incredibly easy to set up lazy load plugin for WordPress.” It’s also one of the few entries on this list that actually comes with some settings.

The plugin is suitable for lazy loading images, videos and iframes in posts, pages, widgets, thumbnails and/or avatars. It also works for post embeds and is WooCommerce compatible (read our beginner’s guide to WooCommerce).

a3 Lazy Load even offers effects images that appear on the site. As if that isn’t enough, it also lets you choose whether to load its script in the header or footer (a lazy load plugin that lazy loads itself, how meta) and ignore images or videos.

Finally, it’s compatible with a whole host of mobile and caching plugins as well as content delivery networks. I’m beginning to see that their claim might not be entirely unfounded.

Crazy Lazy

Crazy Lazy Load WordPress plugin

One of the main reasons I included this plugin is its awesome logo. I mean, look at that snail!

However, besides that, it’s also a lazy load plugin for images that uses very few resources. Crazy Lazy comes with the usual functionality and prevents images from loading before the user sees them. No configuration necessary, just switch it on and you are good.

If you do want to configure something, you are able to set your own placeholder images via CSS (the plugin page contains code for that) and exclude images (it has code for that, too).

Speed Up – Lazy Load

Speed Up lazy load WordPress plugin

Another plugin that keeps images and iframes from loading until necessary. Only 5KB light (do these developers compete in who can make the smallest plugin?) and without any need for configuration. It has a shortcode to deactivate lazy load wherever it isn’t needed and lets you deactivate it for single images as well. So far only 3,000+ installs, however, it comes with a full 5-star rating.

WordPress Infinite Scroll – Ajax Load More

WordPress Infinite Scroll ajax load more WordPress plugin

We talked about infinite scroll earlier, now here’s a plugin to add it to your site.

WordPress Infinite Scroll allows you to lazy load posts, single posts, pages, comments and other page elements by building your own custom shortcodes. You can query different content types by post type or format, date, category, tag and much more. After that, you may add the shortcodes either in the WordPress editor or within templates.

The plugin also works with WooCommerce and Easy Digital Downloads and offers a number of premium addons.

WP YouTube Lyte

Our final entry is a lazy load plugin only for video content. It allows you to input special YouTube links that only load the YouTube player upon click, not earlier.

Basically, all you need to do is change one letter in your link to make it work. Alternatively, you can use shortcodes to input video content or have the plugin parse YouTube links automatically. Plus, it lets you insert only the audio part if needed.

For an alternative, check Lazy Load for Videos.

Lazy Load and WordPress in a Nutshell

With page loading speed continuing to be an important factor for user experience and SEO, lazy load is another tool in your toolbox to improve it. The technique decreases page weight and HTTP requests, allowing visitors to see their desired page more quickly.

Above, we have talked about how lazy loading works and what you can use it for. Besides its main application for images, you can also apply it to videos, scripts, comments, and even posts and pages.

While you need to pay attention to SEO, if used in the right way, lazy load still good option to make your WordPress site faster. If you want to give it a try, one of the plugins on this list is surely able to satisfy your needs.

Frequently Asked Questions (FAQs) about WordPress Lazy Loading

What is the Impact of Lazy Loading on SEO?

Lazy loading can have a positive impact on SEO. It improves the loading speed of your website, which is a crucial factor in Google’s ranking algorithm. Faster websites provide a better user experience, leading to lower bounce rates and higher user engagement. However, it’s important to ensure that your implementation of lazy loading is SEO-friendly. This means that the content should be accessible to search engine bots for indexing.

Can I Implement Lazy Loading Without a Plugin?

Yes, you can implement lazy loading without a plugin. This requires some knowledge of coding and WordPress functions. You can use JavaScript or jQuery to implement lazy loading manually. However, using a plugin simplifies the process and is recommended for those without coding knowledge.

Does Lazy Loading Affect the Quality of Images?

Lazy loading does not affect the quality of images. It simply delays the loading of images that are not in the viewport. Once the user scrolls to the image, it loads normally in its full quality. However, you can combine lazy loading with other techniques like image compression to further improve your site’s performance.

Is Lazy Loading Compatible with All Themes?

Most WordPress themes should be compatible with lazy loading. However, there may be exceptions depending on the theme’s coding. If you encounter issues, it’s recommended to reach out to the theme developer or use a different lazy loading solution.

Can I Use Lazy Loading for Videos?

Yes, you can use lazy loading for videos. Just like with images, lazy loading can delay the loading of videos until they are in the viewport. This can significantly improve the loading speed of pages with embedded videos.

Does Lazy Loading Affect Mobile Users?

Lazy loading can greatly benefit mobile users. Mobile devices often have slower internet connections, so reducing the amount of data that needs to be loaded can significantly improve the user experience. Most lazy loading solutions are responsive and work well on both desktop and mobile devices.

Can I Exclude Certain Images from Lazy Loading?

Yes, most lazy loading plugins allow you to exclude certain images. This can be useful if you have images that are critical to your page’s layout or functionality and need to be loaded immediately.

Does Lazy Loading Work with Sliders and Galleries?

Lazy loading can work with sliders and galleries, but it may require additional configuration. Some sliders and galleries may not be compatible with certain lazy loading solutions. It’s recommended to test your sliders and galleries after implementing lazy loading to ensure they function correctly.

Can Lazy Loading Break My Site?

While it’s rare, there’s a possibility that lazy loading can cause issues with your site. This is usually due to conflicts with other plugins or your theme. If you encounter issues, try disabling other plugins to identify the conflict or use a different lazy loading solution.

How Do I Know if Lazy Loading is Working?

You can check if lazy loading is working by inspecting your site’s source code or using a tool like Google Chrome’s DevTools. You should see that images outside of the viewport are not loaded until you scroll to them. Additionally, you should notice an improvement in your site’s loading speed.

Nick SchäferhoffNick Schäferhoff
View Author

Nick Schäferhoff is an entrepreneur, online marketer, and professional blogger from Germany. When not building websites, creating content or helping his clients improve their online business, he can most often be found at the gym, the dojo or traveling the world with his wife. You can get in touch with him via Twitter or through his website.

WordPressWordPress-hubWordPress-tools
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form