apply_filters( 'wp_preload_resources', array $preload_resources )
- Since
- 6.1.0, 6.6.0
Filters domains and URLs for resource preloads.
Compatibility
- WordPress
- since 6.6.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$preload_resourcesarray- { Array of resources and their attributes, or URLs to print for resource preloads.
@type array ...$0 { Array of resource attributes.
@type string $href URL to include in resource preloads. Required.
@type string $as How the browser should treat the resource (script,style,image,document, etc).
@type string $crossorigin Indicates the CORS policy of the specified resource.
@type string $type Type of the resource (text/html,text/css, etc).
@type string $media Accepts media types or media queries. Allows responsive preloading.
@type string $imagesizes Responsive source size to the source Set.
@type string $imagesrcset Responsive image sources to the source set.
@type string $fetchpriority Fetchpriority value for the resource.
} }...$0arrayArray of resource attributes.$hrefstringURL to include in resource preloads. Required.$asstringHow the browser should treat the resource (script,style,image,document, etc).$crossoriginstringIndicates the CORS policy of the specified resource.$typestringType of the resource (text/html,text/css, etc).$mediastringAccepts media types or media queries. Allows responsive preloading.$imagesizesstringResponsive source size to the source Set.$imagesrcsetstringResponsive image sources to the source set.$fetchprioritystringFetchpriority value for the resource.
Where this hook fires · 1
wp-includes/general-template.php:3992wp_preload_resources()
Source code
* @type string $imagesizes Responsive source size to the source Set. * @type string $imagesrcset Responsive image sources to the source set. * @type string $fetchpriority Fetchpriority value for the resource. * } * } */ $preload_resources = apply_filters( 'wp_preload_resources', array() ); if ( ! is_array( $preload_resources ) ) { return; } $unique_resources = array();Changelog
Introduced in 6.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.6.0
Added the
$fetchpriority attribute.from the docblock6.1.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.