wp_preload_resources

過濾鉤子
apply_filters( 'wp_preload_resources', array()
引數
  • (array) $preload_resources { 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. } }
    Required:
定義位置
相關勾子
wp_resource_hintswp_refresh_nonceswp_prepare_revision_for_jswp_headerswp_redirect
相關方法
wp_preload_resourceswp_preload_dialogswp_resource_hintswp_remote_requestrest_preload_api_requestwp_load_press_this
引入
6.1.0
棄用
-

wp_preload_resources: 這是一個鉤子(hook),用於預載入WordPress頁面上的資源,例如影象和樣式表。通過使用此鉤子,外掛和主題開發者可以指定預載入的資源,以提高頁面的載入速度。

為資源預載入過濾域和URL。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$preload_resources = apply_filters( 'wp_preload_resources', array() );
$preload_resources = apply_filters( 'wp_preload_resources', array() );
$preload_resources = apply_filters( 'wp_preload_resources', array() );

常見問題

FAQs
檢視更多 >