wp_embed_register_handler

函式
wp_embed_register_handler ( $id, $regex, $callback, $priority = 10 )
引數
  • (string) $id An internal ID/name for the handler. Needs to be unique.
    Required:
  • (string) $regex The regex that will be used to see if this handler should be used for a URL.
    Required:
  • (callable) $callback The callback function that will be called if the regex is matched.
    Required:
  • (int) $priority Optional. Used to specify the order in which the registered handlers will be tested. Default 10.
    Required:
    Default: 10
定義位置
相關方法
wp_embed_unregister_handlerwp_oembed_register_routewp_deregister_stylewp_register_fatal_error_handlerwp_remote_retrieve_header
引入
2.9.0
棄用
-

wp_embed_register_handler: 這個函式用來在WordPress中註冊一個新的嵌入處理程式。嵌入處理程式是用來處理文章和頁面中的嵌入內容,如視訊和音訊檔案: 這個函式需要兩個引數:處理程式的名稱和將用於處理嵌入程式碼的回撥函式。

註冊一個嵌入處理程式。

可能只應該被用於不支援oEmbed的網站。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) {
global $wp_embed;
$wp_embed->register_handler( $id, $regex, $callback, $priority );
}
function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) { global $wp_embed; $wp_embed->register_handler( $id, $regex, $callback, $priority ); }
function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) {
	global $wp_embed;
	$wp_embed->register_handler( $id, $regex, $callback, $priority );
}

常見問題

FAQs
檢視更多 >