wp_resource_hints

過濾鉤子
apply_filters( 'wp_resource_hints', $urls, $relation_type )
引數
  • (array) $urls { 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). } }
    Required:
  • (string) $relation_type The relation type the URLs are printed for, e.g. 'preconnect' or 'prerender'.
    Required:
定義位置
相關勾子
wp_preload_resourceswp_signature_hostspassword_hintwp_rest_search_handlerswp_editor_settings
相關方法
wp_resource_hintswp_restore_imagewp_get_password_hintwp_preload_resourceswp_reschedule_eventwp_set_link_cats
引入
4.7.0
棄用
-

wp_resource_hints:這是 WordPress 中的一個動作,它的作用是為頁面新增資源提示。使用這個動作,開發者可以為頁面中的資源(如圖片、字型等)新增提示,以提高頁面的載入速度。

過濾關係型別的資源提示的域和URL。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );
$urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );
$urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );

常見問題

FAQs
檢視更多 >