Skip to content
This repository was archived by the owner on Dec 23, 2020. It is now read-only.

Commit 0d6a94d

Browse files
committed
Do not overwrite existing "loading" attributes from 'wp_get_attachment_image_attributes'
1 parent 5acda2e commit 0d6a94d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

wp-lazy-loading.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function _wp_lazy_loading_add_attribute_to_avatar( $avatar ) {
8383
* @return array Modified attributes.
8484
*/
8585
function _wp_lazy_loading_add_attribute_to_attachment_image( $attr ) {
86-
if ( in_array( 'img', wp_get_lazy_load_tags(), true ) ) {
86+
if ( in_array( 'img', wp_get_lazy_load_tags(), true ) && ! isset( $attr['loading'] ) ) {
8787
$attr['loading'] = 'lazy';
8888
}
8989

0 commit comments

Comments
 (0)