wp_kses_split

函数
wp_kses_split ( $string, $allowed_html, $allowed_protocols )
参数
  • (string) $string Content to filter.
    Required:
  • (array[]|string) $allowed_html An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names.
    Required:
  • (string[]) $allowed_protocols Array of allowed URL protocols.
    Required:
返回值
  • (string) Content with fixed HTML tags
定义位置
相关方法
wp_kses_postwp_kses_hairwp_kses_attrwp_kses_datawp_kses_version
引入
1.0.0
弃用
-

wp_kses_split: 这个函数用于将一串HTML内容分割成一个安全和潜在不安全的块的阵列。

搜索HTML标签,不管是多么畸形的标签。

它还可以匹配游离的`>`字符。

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 );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 20:33:00

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: