> For the complete documentation index, see [llms.txt](https://developers.weglot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.weglot.com/wordpress/use-cases/wp-rocket-lazyload.md).

# Wp-rocket Lazyload

When lazy-loading is enabled (for example by WP Rocket), image URLs are stored in `data-lazy-src` / `data-lazy-srcset` attributes instead of `src` / `srcset`. You can tell the Weglot parser to detect and translate those attributes with the `weglot_get_dom_checkers` filter.

```php
add_filter( 'weglot_get_dom_checkers', 'weglot_dom_check_data_lazy_src' );
function weglot_dom_check_data_lazy_src( $dom_checkers ) {

	if ( ! class_exists( 'Img_Data_Lazy_Src' ) ) {
		class Img_Data_Lazy_Src extends Weglot\Parser\Check\Dom\AbstractDomChecker {
			const DOM       = 'img';
			const PROPERTY  = 'data-lazy-src';
			const WORD_TYPE = Weglot\Client\Api\Enum\WordType::IMG_SRC;
		}
		$dom_checkers[] = '\Img_Data_Lazy_Src';
	}

	if ( ! class_exists( 'Source_Data_Lazy_SrcSet' ) ) {
		class Source_Data_Lazy_SrcSet extends Weglot\Parser\Check\Dom\AbstractDomChecker {
			const DOM       = 'source';
			const PROPERTY  = 'data-lazy-srcset';
			const WORD_TYPE = Weglot\Client\Api\Enum\WordType::IMG_SRC;
		}
		$dom_checkers[] = '\Source_Data_Lazy_SrcSet';
	}

	return $dom_checkers;
}
```
