wp_preload_resources хук-фильтрWP 6.1.0

Filters domains and URLs for resource preloads.

Использование

add_filter( 'wp_preload_resources', 'wp_kama_preload_resources_filter' );

/**
 * Function for `wp_preload_resources` filter-hook.
 * 
 * @param array $preload_resources Array of resources and their attributes, or URLs to print for resource preloads.
 *
 * @return array
 */
function wp_kama_preload_resources_filter( $preload_resources ){

	// filter...
	return $preload_resources;
}
$preload_resources(массив)

Array of resources and their attributes, or URLs to print for resource preloads.

  • ...$0(массив)
    Array of resource attributes.

    • href(строка)
      URL to include in resource preloads. Required.

    • as(строка)
      How the browser should treat the resource (script, style, image, document, etc).

    • crossorigin(строка)
      Indicates the CORS policy of the specified resource.

    • type(строка)
      Type of the resource (text/html, text/css, etc).

    • media(строка)
      Accepts media types or media queries. Allows responsive preloading.

    • imagesizes(строка)
      Responsive source size to the source Set.

    • imagesrcset(строка)
      Responsive image sources to the source set.

    • fetchpriority(строка)
      Fetchpriority value for the resource.

Список изменений

С версии 6.1.0 Введена.
С версии 6.6.0 Added the $fetchpriority attribute.

Где вызывается хук

wp_preload_resources()
wp_preload_resources
wp-includes/general-template.php 3617
$preload_resources = apply_filters( 'wp_preload_resources', array() );

Где используется хук в WordPress

Использование не найдено.