WordPress 增加通訊協定

Posted in :

因為安全理由,所以wordpress 內建只有常見的協定的schema 才會被允許,不常見的協定會被消除,變成空白的,套用為預設的協定,就變成 https 了,所以如果你的網站的超連結想要提供以下的schema:

magnet, skype, line, sms, comgooglemaps, comgooglemapsurl, comgooglemaps-x-callback

可以修改 wordpress theme 裡的 function.php, 加入下面的程式碼:

function custom_add_more_protocols( $protocols ){
	$protocols[] = 'line';
	return $protocols;
}
add_filter( 'kses_allowed_protocols' , 'custom_add_more_protocols' );

相關文章

Browse: Home / Reference / Functions / esc_url()
https://developer.wordpress.org/reference/functions/esc_url/

Description

A number of characters are removed from the URL. If the URL is for displaying (the default behaviour) ampersands are also replaced. The ‘clean_url’ filter is applied to the returned cleaned URL.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *