Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#37458 closed enhancement (wontfix)

Resource Hints: improve filtering

Reported by: dimadin's profile 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 8 years ago.
37458.3.diff (457 bytes) - added by ocean90 8 years ago.

Download all attachments as: .zip

Change History (8)

8 years ago

#1 @SergeyBiryukov
8 years ago

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

#2 @ocean90
8 years ago

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

#3 @peterwilsoncc
8 years 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.

8 years ago

#4 @ocean90
8 years ago

  • Keywords needs-refresh removed

@peterwilsoncc What do you think about 37458.3.diff?

#5 @peterwilsoncc
8 years 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
8 years 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.