搜索HTML标记,无论多么畸形。
原型
wp_kses_split( string $string, array $allowed_html, array $allowed_protocols )
描述
它还匹配流浪的“>”字符。
参数
$string
(string)
(Required)
要过滤的内容
$allowed_html
(array)
(Required)
允许的HTML元素
$allowed_protocols
(array)
(Required)
允许的协议保持
返回值
(string)
具有固定HTML标记的内容
源文件
路径:wp-includes/kses.php
<?php
...
function wp_kses_split( $string, $allowed_html, $allowed_protocols ) {
global $pass_allowed_html, $pass_allowed_protocols;
$pass_allowed_html = $allowed_html;
$pass_allowed_protocols = $allowed_protocols;
return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_kses_split/