Hello Community,
I am noticing a strange behaviour using the wp_get_attachment_image() API into a blade file.
I’d like to disable the loading=“lazy” attribute within one of our hero images. In my hero.blade.php file I have this code:
$image = wp_get_attachment_image(
$imageId,
'full',
false,
[
'class' => 'min-w-[150%] md:min-w-[auto] 3xl:max-w-[70%] 4xl:max-w-[60%]',
'loading' => false,
'data-skip-lazy' => '', // due the fact I am also using A3 Lazy Load plugin
]
);
The die and dump function on $image returns the correct HTML tag, without the loading attribute, as per the “false” value.
But {!! $image !!} is rendering the HTML tag WITH the loading=“lazy” attribute.
Have you got any idea? What am I wrong here?
Thank you