This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Invalid img loading HTML attribute value in Slider widget

5 years ago · Last reply by Andrew Misplon 5 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

6
  1. Alex S Staff 5 years, 3 months ago

    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. Disassembler 5 years, 3 months ago

    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. Disassembler 5 years, 3 months ago

    *invalid HTML generated as

    <img src="..." loading="1">
  4. Alex S Staff 5 years, 3 months ago

    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. Disassembler 5 years, 3 months ago

    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. Andrew Misplon Staff 5 years, 3 months ago

    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.

Have a different question or issue?

Start New Thread