diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php index 838cd84a19921..63062482083d5 100644 --- a/src/wp-includes/blocks.php +++ b/src/wp-includes/blocks.php @@ -2362,6 +2362,7 @@ function render_block( $parsed_block ) { * Parses blocks out of a content string. * * @since 5.0.0 + * @since 6.9.0 The `parse_blocks` filter was added. * * @param string $content Post content. * @return array[] { @@ -2391,7 +2392,16 @@ function parse_blocks( $content ) { $parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' ); $parser = new $parser_class(); - return $parser->parse( $content ); + + /** + * Filter the collection of parsed blocks. + * + * @since 6.9.0 + * + * @param array[] $blocks Array of parsed block objects. + * @param string $content The content that is being parsed. + */ + return apply_filters( 'parse_blocks', $parser->parse( $content ), $content ); } /**