Skip to content

Commit

Permalink
Blocks: add parse_blocks filter to parse_blocks()
Browse files Browse the repository at this point in the history
  • Loading branch information
justlevine committed Jan 1, 2025
1 parent de14028 commit 40a2611
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2242,6 +2242,7 @@ function render_block( $parsed_block ) {
* Parses blocks out of a content string.
*
* @since 5.0.0
* @since 6.?.? The `parse_blocks` filter was added.
*
* @param string $content Post content.
* @return array[] {
Expand Down Expand Up @@ -2271,7 +2272,17 @@ function parse_blocks( $content ) {
$parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' );

$parser = new $parser_class();
return $parser->parse( $content );

Check failure on line 2275 in src/wp-includes/blocks.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Functions must not contain multiple empty lines in a row; found 2 empty lines

/**
* Filter the collection of parsed blocks.
*
* @since 6.?.?
*
* @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 );
}

/**
Expand Down

0 comments on commit 40a2611

Please sign in to comment.