参数
$protocols
string[]-
允许的协议数组,例如
'http'
、'ftp'
、'tel'
等。
源码
更新日志
版本 | 描述 |
---|---|
3.0.0 | 开始引入 |
使用示例
允许Skype调用链接。
add_filter( 'kses_allowed_protocols', function ( $protocols ) { $protocols[] = 'skype'; return $protocols; } );
过滤器应该在init之前运行。
注意:此示例仅适用于PHP 5.3+
function wpse_allow_sms_protocol( $protocols ) { $protocols[] = 'sms'; return $protocols; } add_action('plugins_loaded', function(){add_filter('kses_allowed_protocols', 'wpse_allow_sms_protocol' );}); print_r(wp_allowed_protocols());