Make WordPress Core

Opened 22 months ago

Closed 22 months ago

Last modified 22 months ago

#56002 closed defect (bug) (worksforme)

Filter is missing?

Reported by: gorostas's profile 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)

#1 @johnbillion
22 months ago

  • Component changed from General to Media

@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

#2 @gorostas
22 months 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 @ironprogrammer
22 months 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!

#4 @johnbillion
22 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I've correct the original blog post. Thanks again for the report @gorostas.

#5 @johnbillion
22 months ago

#56043 was marked as a duplicate.

Note: See TracTickets for help on using tickets.