Prevent WordPress image from being lazy loaded

You need to set the loading attribute to eager.

wp_get_attachment_image(
    $image_id,
    'full',
    false,
    [ 'loading' => 'eager' ], // Prevent image from being lazy loaded.
);

Leave a Reply

Your email address will not be published. Required fields are marked *