do_blocks
函数
do_blocks ( $content )
- 参数
-
-
(string)
$content
Post content.- Required: 是
-
(string)
- 返回值
-
- (string) Updated post content.
- 定义位置
-
-
wp-includes/blocks.php
, line 1084
-
wp-includes/blocks.php
- 引入
- 5.0.0
- 弃用
- –
分析“post_content”中的动态区块并重新渲染它们。
function do_blocks( $content ) {
$blocks = parse_blocks( $content );
$output = '';
foreach ( $blocks as $block ) {
$output .= render_block( $block );
}
// If there are blocks in this content, we shouldn't run wpautop() on it later.
$priority = has_filter( 'the_content', 'wpautop' );
if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) {
remove_filter( 'the_content', 'wpautop', $priority );
add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
}
return $output;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。