wpseek.com
WordPress开发者和主题制作者的搜索引擎



do_blocks › WordPress Function

Since5.0.0
已弃用n/a
do_blocks ( $content )
参数:
  • (string) $content Post content.
    Required: Yes
返回:
  • (string) Updated post content.
定义在:
文档:

Parses dynamic blocks out of `post_content` and re-renders them.



源码

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