do_blocks( string $content )
Parses dynamic blocks out of post_content
and re-renders them.
Description Description
Parameters Parameters
- $content
-
(string) (Required) Post content.
Return Return
(string) Updated post content.
Source Source
File: wp-includes/blocks.php
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | function do_blocks( $content ) { // 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 ); } $blocks = parse_blocks( $content ); $output = '' ; foreach ( $blocks as $block ) { $output .= render_block( $block ); } return $output ; } |
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |