Make WordPress Core


Ignore:
Timestamp:
08/05/2022 06:24:42 PM (2 years ago)
Author:
adamsilverstein
Message:

Script loader: enable resource preloading with rel='preload'.

Add a wp_preload_resources filter that developers can use to add resource preloading.

Preloading helps the browser discover and prioritize important resources earlier during the page load. This ensures that they are available earlier and are less likely to block the page's render.

Props nico23, swissspidy, igrigorik, westonruter, azaozz, furi3r, aristath, spacedmonkey, peterwilsoncc, mihai2u, gziolo. 
Fixes #42438.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r53455 r53846  
    325325add_action( 'wp_head', 'wp_enqueue_scripts', 1 );
    326326add_action( 'wp_head', 'wp_resource_hints', 2 );
     327add_action( 'wp_head', 'wp_preload_resources', 1 );
    327328add_action( 'wp_head', 'feed_links', 2 );
    328329add_action( 'wp_head', 'feed_links_extra', 3 );
Note: See TracChangeset for help on using the changeset viewer.