Given an HTML document, this function fully-parses block content, producing a tree of blocks and their contents, as well as top-level non-block content, which will appear as a block with no blockName. This function can be memory heavy for certain documents, particularly those with deeply-nested blocks or blocks with extensive attribute values. Further, this function must parse an entire document in one atomic operation. If the entire parsed document is not necessary, consider using WP_Block_Processor instead, as it provides a streaming and low-overhead interface for finding blocks.
Parameters
$contentstring
Post content.
Return
array[]
Array of block structures.
...$0array
An associative array of a single parsed block object. See WP_Block_Parser_Block.
$blockNamestring|null
Name of block.
$attrsarray
Attributes from block comment delimiters.
$innerBlocksarray[]
List of inner blocks. An array of arrays that have the same structure as this one.
$innerHTMLstring
HTML from inside block comment delimiters.
$innerContentarray
List of string fragments and null markers where inner blocks were found.
Hooks fired · 1
One hook fires while parse_blocks() runs, in this order:
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/blocks.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.