Lazy Loading: Wordpress Images And Largest Contentful Paint

don

Lazy loading is a process that delays the loading of images until they are needed, meaning that they will not load until they are viewable in the browser viewport. While lazy loading is recommended for offscreen images, it is not recommended for above-the-fold content like the Largest Contentful Paint (LCP) image. This is because the browser may defer the LCP image in favour of other resources, which can slow down LCP timing and make your page appear visually incomplete for longer. To avoid this issue when using WordPress, you can use a plugin like WP Rocket or FlyingPress to exclude the LCP image from lazy loading, or you can manually adjust how many images to exclude from lazy loading using the wp_omit_loading_attr_threshold() function.

Characteristics Values
LCP images Should not be lazy loaded
Lazy loading Should be applied to offscreen images
Above-the-fold images Should be shown immediately and not lazy loaded
Preloading critical images Should be done to exclude them from lazy load
Plugins WP Rocket, FlyingPress, LiteSpeed Cache, WP Fastest Cache, Optimole

cypaint

Install the free Optimole plugin to exclude images from lazy loading

If you're using WordPress, you can install the free Optimole plugin to exclude images from lazy loading. Optimole is a versatile tool used for optimising images and can be installed like any other free plugin. It enables lazy loading by default but also automatically excludes the first three images from being lazy loaded.

To install Optimole, log in to your WordPress admin panel and go to Plugins -> Add New. Once you've found the Optimole plugin, click "Install now". After the installation finishes, click "Activate". You will then be asked to register for an account and input your personal API key to connect to the Optimole service.

Once you've connected to the plugin, you should see the Optimole dashboard. You can always access it by going to Media -> Optimole. If you want to exclude additional images from lazy loading, you can go to Settings -> Advanced -> Lazyload in the Optimole area of your WordPress dashboard.

Optimole offers a range of other useful image optimisation features, such as the ability to detect the hero image on web pages and ensure its quick loading, custom lazy load placeholders, and adaptive quality. It also helps you compress images automatically, resize them, and deliver them via lightning-fast CDN from 450+ locations.

cypaint

Use WP Rocket to exclude LCP images from lazy loading

Lazy loading is a process that delays the loading of images until they are needed. This means that images will not load until they are scrolled to (i.e., viewable in the browser viewport), which helps the browser prioritize other resources that are more important. However, it is not recommended to lazy load above-the-fold content like your Largest Contentful Paint (LCP) image as it may slow down your LCP timing and make your page appear visually incomplete to the user for longer.

WP Rocket is a performance plugin that automatically applies 80% of web performance best practices, making your website load faster immediately. It has an automatic Critical Image Optimization feature, which is enabled by default upon activation. This option automatically detects the LCP image, preloads it, and excludes it from lazy loading.

To exclude the LCP image from lazy loading, you can use the Excluded images or iframes field in the plugin settings. To do so, input the file name, CSS class, img attribute, domain name (for external images), or CSS file name of the image you don’t want to load lazily in the box and save.

If you want more control over how lazy loading works in WP Rocket, you can also modify it with markup. The snippets will go into your functions.php or a plugin for this purpose.

It is important to note that WP Rocket is not the only way to exclude LCP images from lazy loading in WordPress. Another option is to use the free Optimole plugin, which offers optimized lazy loading plus tons of other image optimization features.

cypaint

Avoid lazy loading above-the-fold content

Lazy loading is a process that delays the loading of images until they are needed. This means that images will not load until they are scrolled to (i.e., viewable in the browser viewport), which helps the browser prioritize other resources that are more important.

However, it is not recommended to lazy load above-the-fold content like your Largest Contentful Paint (LCP) image. LCP is one of the Web Vitals, and there are SEO benefits associated with improving it. If lazy loading is applied to above-the-fold content, the browser may defer the LCP image in favor of other resources, which may slow down your LCP timing and make your page appear visually incomplete to the user for longer.

To avoid lazy loading above-the-fold content in WordPress, you can use a plugin like WP Rocket or Optimole. WP Rocket is a performance plugin that automatically applies 80% of web performance best practices and can exclude the LCP image from lazy loading when it's an image above-the-fold.

Optimole is a free plugin that enables lazy loading by default and automatically excludes the first three images from being lazy loaded. You can also manually adjust how many images to exclude from lazy loading in the settings.

Another option is to add a code snippet to adjust WordPress's native browser lazy loading functionality. You can use the wp_omit_loading_attr_threshold() function to manually adjust how many images to exclude from lazy loading.

cypaint

Preload critical images

Preloading critical images is an important technique to improve the performance of your WordPress site, especially when it comes to the Largest Contentful Paint (LCP) image. LCP is one of the Web Vitals, and improving it brings SEO benefits.

Preloading allows you to specify which resources, such as images, are needed immediately during page load. This helps fix render-blocking resource warnings and ensures that critical images are loaded first, improving the user experience.

When using WordPress, you can take advantage of plugins like WP Rocket to optimize critical images. This plugin automatically detects the LCP image, preloads it, and ensures it is not lazy-loaded. It also allows you to set a location, so you can preload an image only on your homepage or a specific page.

Another popular option is the free Optimole plugin, which enables lazy loading by default and automatically excludes the first few images, including the LCP image, from being lazy-loaded. This can help improve LCP times and overall web performance.

While preloading critical images can greatly improve performance, it's important to be mindful of potential side effects. In some cases, preloading may prioritize fetching the image over critical stylesheets, increasing the time before anything is rendered on the page. Therefore, it's crucial to test and monitor the impact of preloading to ensure it's benefiting your site's performance.

cypaint

Use FlyingPress to optimise LCP

FlyingPress is a speed optimisation plugin for WordPress that can be used to improve your website's Core Web Vitals. It is a simple, user-friendly interface that makes website speed optimisation accessible to both professionals and novices.

FlyingPress has several features that can help optimise LCP. Firstly, it uses native lazy loading, which can be enabled to improve LCP by excluding above-the-fold images from lazy loading. This is an issue with many other lazy load plugins, which improperly lazy load these images and compromise the LCP metric. FlyingPress allows you to manually exclude these images by adding their image URLs.

Another feature is the ability to preload critical images. FlyingPress will detect above-the-fold images and preload them to improve LCP. This is often a manual process with other cache plugins.

In addition, FlyingPress removes bloat, hosts third-party code locally, and optimises LCP images. It also has a powerful Cloudflare Enterprise (FlyingCDN) feature, which serves smaller images to mobile devices, improving mobile LCP scores.

With its innovative features and focus on community feedback, FlyingPress is a powerful tool to optimise LCP and improve your website's overall performance.

Frequently asked questions

Lazy loading is the process of delaying the loading of images until they are needed. This means images will not load until they are scrolled to (i.e., viewable in the browser viewport), which helps the browser prioritize other resources that are more important.

Lazy loading the LCP image can slow down your LCP timing and make your page appear visually incomplete to the user for longer. Google's research suggests that it can extend your page's LCP timing.

You can use a plugin like WP Rocket or FlyingPress, which automatically excludes the LCP image from lazy loading when it's an image above-the-fold. Alternatively, you can use the free Optimole plugin, which enables lazy loading by default but also excludes the first three images from being lazy loaded.

You can compress images, use correct dimensions, use faster image formats (e.g. WebP), and serve smaller image sizes to mobile devices via CDNs or an adaptive images plugin.

LCP is one of the Web Vitals, and there are SEO benefits associated with improving it. It measures when the largest content element becomes visible in the viewport.

Written by
Reviewed by

Explore related products

Share this post
Print
Did this article help you?

Leave a comment