#56002 closed defect (bug) (worksforme)
Filter is missing?
Reported by: | gorostas | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description
Hi,
based on this page https://make.wordpress.org/core/2020/01/29/lazy-loading-images-in-wordpress-core/ there is this filter - that I tried to hook on wp_set_image_loading_attr
- but it's not working.
To be sure grep -r "wp_set_image_loading_attr" --include=*.php
in web root returns nothing.. so - two things here:
- documentation is obsolete.
- functionality is crippled.
I needed this hook today (but surely there will be others) to be able to selectively (per image) turn lazy ON|OFF .. and wp_lazy_loading_enabled
can't fit it because it's global.
Thanks, Kres
Change History (5)
#2
@
2 years ago
Wow @johnbillion
that one works like charm - thanks :)
I could update the page and also paste example for this dedicated page for this filter https://developer.wordpress.org/reference/hooks/wp_img_tag_add_loading_attr/ - but don't know exact github branch - if you send me I can do it :)
Thank
#3
@
2 years ago
Hi, @gorostas! Thanks for offering to update the documentation 🙌🏻. In this case, it is a Core developer blog post that needs adjustment, not accessible via GitHub.
There is a User Contributed Notes section at the bottom of developer documentation pages where snippets are sometimes shared related to use of a particular function.
Thanks again for your report!
@gorostas Thanks for the report. I think the correct filter is wp_img_tag_add_loading_attr. Can you check and confirm please? If so we'll get the documentation corrected.
cc @flixos90