wp_embed_handler_audio

函式
wp_embed_handler_audio ( $matches, $attr, $url, $rawattr )
引數
  • (array) $matches The RegEx matches from the provided regex when calling wp_embed_register_handler().
    Required:
  • (array) $attr Embed attributes.
    Required:
  • (string) $url The original URL that was matched by the regex.
    Required:
  • (array) $rawattr The original unmodified attributes.
    Required:
返回值
  • (string) The embed HTML.
定義位置
相關方法
wp_embed_handler_videowp_embed_handler_youtubewp_embed_handler_googlevideowp_embed_register_handlerwp_embed_defaults
引入
3.6.0
棄用
-

wp_embed_handler_audio: 這個函式是一個回撥函式,用於處理WordPress中的音訊嵌入: 當使用者在文章或頁面中嵌入一個音訊檔案時,這個函式被呼叫來處理嵌入程式碼。

音訊嵌入處理回撥。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) {
$audio = sprintf( '<a class="wp-embedded-audio" href="https://www.wbolt.com/tw/go?_=92cfa6365faHR0cDovLyZxdW90OyVzJnF1b3Q7" rel="noopener noreferrer nofollow" target="_blank">"%s"</a>', esc_url( $url ) );
/**
* Filters the audio embed output.
*
* @since 3.6.0
*
* @param string $audio Audio embed output.
* @param array $attr An array of embed attributes.
* @param string $url The original URL that was matched by the regex.
* @param array $rawattr The original unmodified attributes.
*/
return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr );
}
function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) { $audio = sprintf( '<a class="wp-embedded-audio" href="https://www.wbolt.com/tw/go?_=92cfa6365faHR0cDovLyZxdW90OyVzJnF1b3Q7" rel="noopener noreferrer nofollow" target="_blank">"%s"</a>', esc_url( $url ) ); /** * Filters the audio embed output. * * @since 3.6.0 * * @param string $audio Audio embed output. * @param array $attr An array of embed attributes. * @param string $url The original URL that was matched by the regex. * @param array $rawattr The original unmodified attributes. */ return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr ); }
function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) {
	$audio = sprintf( '"%s"', esc_url( $url ) );

	/**
	 * Filters the audio embed output.
	 *
	 * @since 3.6.0
	 *
	 * @param string $audio   Audio embed output.
	 * @param array  $attr    An array of embed attributes.
	 * @param string $url     The original URL that was matched by the regex.
	 * @param array  $rawattr The original unmodified attributes.
	 */
	return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr );
}

常見問題

FAQs
檢視更多 >