Benefits of Lazy Load for WordPress
You’re likely aware of how important page loading speed is. Suffice it to say that every second counts when you’re competing for the top spot in search results. You might be wondering, however, what you can do to improve your site’s performance.
Fortunately, there are a couple of options when it comes to improving how your pages load. Through a process called ‘lazy loading’, for example, you can speed things up by controlling when the more burdensome elements of your pages (such as images) appear.
In this article, we’ll take a look at what exactly lazy loading images is and how it works. We’ll also walk through how to implement this technique, both manually and with a plugin. Let’s get started!
What Is Lazy Loading in WordPress? Lazy Load Pros and Cons
Lazy loading images is a way to reduce the number of calls a visitor’s browser has to make to your website’s server. Essentially, the loading of your website can get bogged down when lots of calls to your server are made at once. If all of your images are attempting to load at the same time, for example, this can cause issues.
When you use the lazy loading approach, you can create placeholders for images, and then have the real images only load fully when they are needed. As a visitor scrolls down a page, for example, images might load as and when they need to appear.
This approach has several pros and cons, which you’ll want to consider before implementing it on your website. The benefits include:
- Site visitors won’t need to use as much bandwidth to view your pages.
- You can boost your search rankings.
- You’ll be able to provide a better mobile experience.
As for the downsides, some type of lazy loading can cause search engine indexing issues. In addition, for people who scroll through content quickly, lazy loaded images can create a poorer experience. However, it can be a technique worth considering if your site is slow to load.
Adding Lazy Load to Your WordPress Site
Now that we’ve answered the question ‘What is lazy loading in WordPress?’, it’s time to learn how to add it to your site. If you’re concerned about performance, the first step is to find out how fast or slow your site’s pages are. One way you can assess your site’s performance is with our own Speed Test tool.
This tool will let you know how your site is performing. Plus, it will offer tips for making improvements, so you’ll know exactly where to focus your efforts.
If one of the steps you decide to take is adding lazy loading to your WordPress website, you have a few lazy load options. You can rely on the default WordPress functionality, or use a plugin to customize the way lazy loading works on your site.
Adding Lazy Load With a Plugin – WP Rocket Lazy Loading
Fortunately, there are many lazy loading plugins available. For example, Lazy Load by WP Rocket is an excellent solution. This plugin is straightforward, but can significantly reduce the weight of your pages (thus speeding them up). In the following two steps, we’ll show you how to use it.
Step 1: Download the Plugin
To get started, you’ll need to download and activate the Lazy Load plugin.
It’s a free tool, so you can pick it up right from the WordPress Plugin Directory. Once you’ve done that, you’ll just have a few quick settings to configure.
Step 2: Configure the Plugin’s Settings
Next, you can navigate to Settings > Lazy Load in your WordPress dashboard to configure the plugin’s options.
Here, you’ll choose what aspects of your site’s pages you want lazy loading to handle.
Simply check the boxes for the items you’d like to include. You can have the plugin handle images, iframes, and videos. Lazy Load by WP Rocket can also replace YouTube videos with thumbnails until your site’s users have that piece of content in view.
Adding Lazy Load Manually
For a long time, if you wanted to implement lazy loading manually on your site, you needed to edit core files manually and add custom scripts to them. However, with the release of WordPress 5.5, lazy loading is now a part of the core software.
WordPress now implements lazy loading by default for any images on your site that have width and height attributes. To do that, WordPress uses the following attribute pair:
If you’re using the latest version of WordPress, you should see this attribute within the img tags for any image you’ve uploaded to your site. In practice, that should look something like this:
<img src=“your-image-file.png” loading=“lazy” alt=“This is a lazy loaded image!” />
Although native lazy loading implementation makes things a lot easier in WordPress, not all browsers support the loading attribute that it uses. Using a plugin such as LazyLoad by WP Rocket ensures better support across most browsers, and it also enables you to use lazy loading for other types of elements.
Lazy Loading Videos in WordPress
Unlike images, your browser doesn’t load videos on a page in their entirety when you visit, at least by default. Instead, it checks an attribute called preload, which tells your browser whether to pre-load a video or just load its metadata. If you pre-load videos, they should start playing immediately once users click on them.
The downside of preloading videos is that it often impacts your loading times. By implementing lazy load options for videos, you tell visitors’ browsers not to pre-load any video until it’s needed. In most cases, that shouldn’t impact the user experience, and it can even increase performance if you include multiple videos on your pages.
As we mentioned before, the LazyLoad plugin supports lazy loading for various media types. That makes it one of the best lazy load plugins for WordPress users who embed videos. If you’ve uploaded videos that you want to share to WordPress, we recommend enabling the IFrames and Videos setting pictured earlier.
Lazy Loading in WordPress & SEO
As you may know, search engines crawl your website to index its pages and other elements, including images. Although lazy loading can drastically increase site performance, in certain cases it can also prevent search engines from indexing images. That means those files won’t appear in image search results, which can reduce your overall organic traffic.
To avoid that issue, you’ll want to use a lazy loading plugin that’s SEO friendly (such as LazyLoad). If you use WordPress’ built-in lazy load options, you’ll want to ensure that your site properly loads images when they’re visible in the viewport.
Additionally, you shouldn’t forget to use alt tags for all of the images on your website. Even if you’re using lazy load in WordPress, alt tags provide context that search engines can use to determine the contents of your images.
Create With Agility on WP Engine
Adding elements such as a lazy loading feature can help take your website to the next level. Not only can this improve your search rankings, but it can also give your site’s users a better experience.
Here at WP Engine, we know what a difference the right developer resources can make to your website. Additionally, we offer helpful solutions to help you improve your site’s speed, along with plans for all your website needs!