Make WordPress Core

#37458 closed enhancement (wontfix)

Resource Hints: improve filtering

Reported by: dimadin Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Script Loader Keywords: has-patch
Focuses: docs Cc:


By looking at name and description of wp_resource_hints filter, one would assume that it filters all resource hints, while it is in foreach loop filtering only one relation type at the time. This means that unless you want to always pass an empty array, you need to arguments and then conditional.

I suggest that we change this before RC. There are a few ways to do, attached is with moving filter with wp_resource_hints name before loop and filtering all resource hints there, while making current filter name dynamic, based on relation type currently used,

Attachments (2)

37458.diff (1.5 KB) - added by dimadin 20 months ago.
37458.3.diff (457 bytes) - added by ocean90 20 months ago.

Download all attachments as: .zip

Change History (8)

20 months ago

#1 @SergeyBiryukov
20 months ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.6

#2 @ocean90
20 months ago

For 4.6 we should only improve the docs of the existing filter.

#3 @peterwilsoncc
20 months ago

  • Component changed from General to Script Loader
  • Focuses docs added
  • Keywords needs-refresh added

Needs refresh following @ocean90's comment re 4.6.

There is a reluctance to add further dynamic filter names to WP core as it makes searching more difficult, passing parameters is preferred.

20 months ago

#4 @ocean90
20 months ago

  • Keywords needs-refresh removed

@peterwilsoncc What do you think about 37458.3.diff?

#5 @peterwilsoncc
20 months ago

In 38161:

Script Loader: Clarify documentation of wp_resource_hints hook.

Specify that the wp_resource_hints hook is firing for a single relation type.

Props: dimadin for initial patch.
See #37458.

#6 @peterwilsoncc
20 months ago

  • Milestone 4.6 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

The documentation has been improved in [38161].

I'm going to close this off as wontfix for the reasons I mentioned earlier about dynamic filters.

Note: See TracTickets for help on using tickets.