[wp-trac] [WordPress Trac] #42438: Add support for preload links (similar to resource hints)

WordPress Trac noreply at wordpress.org
Mon Aug 15 17:56:14 UTC 2022


#42438: Add support for preload links (similar to resource hints)
-------------------------------------------------+-------------------------
 Reporter:  nico23                               |       Owner:  swissspidy
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.1
Component:  Script Loader                        |     Version:  4.9
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-unit-tests has-patch commit      |     Focuses:
  needs-dev-note                                 |  performance
-------------------------------------------------+-------------------------

Comment (by adamsilverstein):

 For a more declarative API, thinking something like
 [attachment:"42438-function.diff"] -

 * Add a function `wp_add_preload_resources` which accepts an array of
 resources to preload with the same structure as the `wp_preload_resources`
 filter.
 * Since the filter runs later, it can still be used as a final way to
 direct the preloads, with the function as the recommended approach for
 adding a preload.
 * Adds testing for the new function, conveniently using the same data
 provider as the tests for `wp_preload_resources`.

 What do you think @swissspidy / @azaozz ?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/42438#comment:66>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list