apply_filters( ‘wp_resource_hints’, array $urls, string $relation_type )

In this article

Filters domains and URLs for resource hints of relation type.

Parameters

$urlsarray
Array of resources and their attributes, or URLs to print for resource hints.
  • ...$0 array|string
    Array of resource attributes, or a URL string.
    • href string
      URL to include in resource hints. Required.
    • as string
      How the browser should treat the resource (script, style, image, document, etc).
    • crossorigin string
      Indicates the CORS policy of the specified resource.
    • pr float
      Expected probability that the resource hint will be used.
    • type string
      Type of the resource (text/html, text/css, etc).
$relation_typestring
The relation type the URLs are printed for, e.g. 'preconnect' or 'prerender'.

Source

$urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );

Changelog

VersionDescription
4.7.0The $urls parameter accepts arrays of specific HTML attributes as its child elements.
4.6.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.