filter_block_content
函数
filter_block_content ( $text, $allowed_html = 'post', $allowed_protocols = array() )
- 参数
-
-
(string)
$text
Text that may contain block content.- Required: 是
-
(array[]|string)
$allowed_html
Optional. 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. Default ‘post’.- Required: 否
- Default: ‘post’
-
(string[])
$allowed_protocols
Optional. Array of allowed URL protocols. Defaults to the result of wp_allowed_protocols().- Required: 否
- Default: array()
-
(string)
- 返回值
-
- (string) The filtered and sanitized content result.
- 定义位置
-
-
wp-includes/blocks.php
, line 794
-
wp-includes/blocks.php
- 引入
- 5.3.1
- 弃用
- –
Filters and sanitizes block content to remove non-allowable HTML
from parsed block attribute values.
function filter_block_content( $text, $allowed_html = 'post', $allowed_protocols = array() ) { $result = ''; $blocks = parse_blocks( $text ); foreach ( $blocks as $block ) { $block = filter_block_kses( $block, $allowed_html, $allowed_protocols ); $result .= serialize_block( $block ); } return $result; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。