wppaste
WordPress

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.
} }
  • ...$0array

    Array of resource attributes.
    • $hrefstring

      URL to include in resource preloads. Required.
    • $asstring

      How the browser should treat the resource (script, style, image, document, etc).
    • $crossoriginstring

      Indicates the CORS policy of the specified resource.
    • $typestring

      Type of the resource (text/html, text/css, etc).
    • $mediastring

      Accepts media types or media queries. Allows responsive preloading.
    • $imagesizesstring

      Responsive source size to the source Set.
    • $imagesrcsetstring

      Responsive image sources to the source set.
    • $fetchprioritystring

      Fetchpriority 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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

6.6.0
Added the $fetchpriority attribute.from the docblock
6.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.