Home>Support>Invalid img loading HTML attribute value in Slider widget

Invalid img loading HTML attribute value in Slider widget

SiteOrigin Image Slider widget generates images with

loading="1"
as
<img>
attribute. The only valid values for loading attribute according to HTML standards are “eager” and “lazy”. The value “1” is invalid.

In order to fix the invalid HTML, one needs to modify wp-content/plugins/so-widgets-bundle/widgets/slider/slider.php and change

'loading' => true
to
'loading' => 'eager'
on lines 171 and 201 (in version 1.17.8 of SiteOrigin Widgets Bundle)

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 3 years, 10 months ago Alex S
    Hi, I Work Here

    Hi Disassembler,

    Thank you for reporting this. This was done to avoid a WordPress bug when disabling lazy loading. You can read more about this change here. Let me know if you have any further questions.

    Kind regards,
    Alex

  2. 3 years, 10 months ago Disassembler

    Hi Alex,
    Value “true” is not allowed in the loading parameter, see https://developer.wordpress.org/reference/functions/wp_get_attachment_image/ – only boolean false or a string is allowed. Setting ‘loading’ => true as it is now results in invalid HTML generated as , as per my original report (sorry about the formatting), hence I’m suggesting setting to a string value ‘eager’, which is allowed, results in valid HTML and still keeps the lazy loading disabled.

  3. 3 years, 10 months ago Disassembler

    *invalid HTML generated as

    <img src="..." loading="1">
  4. 3 years, 10 months ago Alex S
    Hi, I Work Here

    Hi Disassembler,

    I’ve forwarded your feedback to the rest of the team, and I’ll investigate this further shortly. If WordPress has resolved the issue related to using values other than false we’ll look towards changing this value to more valid options.

    https://github.com/siteorigin/so-widgets-bundle/issues/new

    Kind regards,
    Alex

  5. 3 years, 10 months ago Disassembler

    I see that the proposed change has been merged into the develop branch on GitHub a few days ago. Eagerly (pun intended) looking forward to the next release. :) Thank you.

  6. 3 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    Hahaha :) Thanks for checking in.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More