我正在尝试将<a href="skype:sitspak?call">
放在WordPress安装的页脚中。
为了实现这一目标,我将skype
协议添加到wp_allowed
。
以下是来自 functions.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' );
/**
* 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 = apply_filters( 'kses_allowed_protocols', $protocols );
}
return $protocols;
我将以下代码放在我的孩子主题 function.php
//
// Your code goes below
//
function ss_allow_skype_protocol( $protocols ){
array_push($protocols, 'skype');
return $protocols;
}
add_filter( 'kses_allowed_protocols' , 'ss_allow_skype_protocol' );
但由于某种原因,这不起作用;我怎样才能成功实现这一目标?
答案 0 :(得分:0)
您是否将第一段代码放入functions.php中?您只需要过滤器调用(第二个代码块),一切都应该正常工作。