检索允许HTML属性的协议列表。
原型
wp_allowed_protocols()
返回值
(array)
允许的协议数组。默认为包含’http’,‘https’,‘ftp’,‘ftps’,‘mailto’,‘news’,‘irc’,‘gopher’,‘nntp’,‘feed’,‘telnet’,‘的数组mms’,‘rtsp’,‘svn’,‘tel’,‘fax’,‘xmpp’,‘webcal’和’urn’。
源文件
路径:wp-includes/functions.php
<?php
...
function wp_allowed_protocols() {
static $protocols = array();
if ( empty( $protocols ) ) {
$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'urn' );
}
if ( ! did_action( 'wp_loaded' ) ) {
/**
* Filters the list of protocols allowed in HTML attributes.
*
* @since 3.0.0
*
* @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
*/
$protocols = array_unique( (array) apply_filters( 'kses_allowed_protocols', $protocols ) );
}
return $protocols;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_allowed_protocols/