You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 23, 2020. It is now read-only.
Seems that iframes will not support the loading attribute for now. Support will be added in the future.
Generally this would mean refactoring or even dropping the existing wp_get_lazy_load_tags(). It may be "nice to have" a way to globally disable auto-adding of that attribute on the front-end, but not sure that's needed. Ideally there should be a way to change/disable it on per-case (per-image) basis that is also "simple enough" to use to globally disable it in all cases.
As far as I see there are couple of ways to do that:
Introduce a filter that will run on adding the attribute to each <img> tag, and passes some context where that tag is. This will also allow plugins to "fine-tune" where the attribute is added and/or make it conditional on the context. Possible downside is that such filter will be quite "noisy". It will run anywhere form 10-15 times up to few hundred times per page load (in case of big galleries, etc.).
Keep wp_get_lazy_load_tags() as a "wrapper" function that will only run the 'wp_get_lazy_load_tags' filter (similarly to how it works now but without support for iframes). In this case it can be extended in the future when iframes start to support the "loading" attribute. Ideally it should also pass some context, for example current_filter() or a hard-coded value when it is called "by hand" like from get_avatar(), etc.