Filters domains and URLs for resource hints of the given relation type.
Parameters
$urlsarray
{ Array of resources and their attributes, or URLs to print for resource hints. @type array|string ...$0 { Array of resource attributes, or a URL string. @type string $href URL to include in resource hints. 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 float $pr Expected probability that the resource hint will be used. @type string $type Type of the resource (text/html, text/css, etc). } }
...$0array|string
Array of resource attributes, or a URL string.
$hrefstring
URL to include in resource hints. Required.
$asstring
How the browser should treat the resource (script, style, image, document, etc).
$crossoriginstring
Indicates the CORS policy of the specified resource.
$prfloat
Expected probability that the resource hint will be used.
$typestring
Type of the resource (text/html, text/css, etc).
$relation_typestring
The relation type the URLs are printed for. One of 'dns-prefetch', 'preconnect', 'prefetch', or 'prerender'.
3515* @type string$type Type of the resource(`text/html`,`text/css`, etc).3516*}3517*}3518* @param string$relation_type The relation type the URLs are printed for. One of3519*'dns-prefetch','preconnect','prefetch',or'prerender'.3520*/3521$urls=apply_filters('wp_resource_hints',$urls,$relation_type);35223523foreach($urlsas$key=>$url){3524$atts=array();35253526if(is_array($url)){3527if(isset($url['href'])){
History
Introduced in 4.6.0. Unchanged from 6.7.7 through 7.1.0.