wp_kses_allowed_html
函数
wp_kses_allowed_html ( $context = '' )
- 参数
-
-
(string|array)
$context
The context for which to retrieve tags. Allowed values are ‘post’, ‘strip’, ‘data’, ‘entities’, or the name of a field filter such as ‘pre_user_description’, or an array of allowed HTML elements and attributes.- Required: 否
- Default: (empty)
-
(string|array)
- 返回值
-
- (array) Array of allowed HTML tags and their allowed attributes.
- 定义位置
-
-
wp-includes/kses.php
, line 847
-
wp-includes/kses.php
- 引入
- 3.5.0
- 弃用
- –
返回一个允许的HTML标签和属性的数组,用于给定的环境。
function wp_kses_allowed_html( $context = '' ) { global $allowedposttags, $allowedtags, $allowedentitynames; if ( is_array( $context ) ) { // When `$context` is an array it's actually an array of allowed HTML elements and attributes. $html = $context; $context = 'explicit'; /** * Filters the HTML tags that are allowed for a given context. * * HTML tags and attribute names are case-insensitive in HTML but must be * added to the KSES allow list in lowercase. An item added to the allow list * in upper or mixed case will not recognized as permitted by KSES. * * @since 3.5.0 * * @param array[] $html Allowed HTML tags. * @param string $context Context name. */ return apply_filters( 'wp_kses_allowed_html', $html, $context ); } switch ( $context ) { case 'post': /** This filter is documented in wp-includes/kses.php */ $tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context ); // 5.0.1 removed the `
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。