WP HOOKS
filtrod 4.6.0

wp_resource_hints

Args 2Plik wp-includes/general-template.phpDokumentacja WP ↗

Opis — z kodu źródłowego

Filters domains and URLs for resource hints of the given relation type.

Parametry

ParametrTypOpis
$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 (<code>script</code>, <code>style</code>, <code>image</code>, <code>document</code>, 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 (<code>text/html</code>, <code>text/css</code>, etc). } }
$relation_typestringThe relation type the URLs are printed for. One of 'dns-prefetch', 'preconnect', 'prefetch', or 'prerender'.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'wp_resource_hints', 'twoja_funkcja', 10, 2 );

function twoja_funkcja($param_1, $param_2) {
	// Twój kod
}

Popularne w tej kategorii