WordPress at Your Fingertips
function is not described

WP_Block_Parser::parse() public WP 5.0.0

Parses a document and returns a list of block structures

When encountering an invalid parse will return a best-effort parse. In contrast to the specification parser this does not return an error on invalid inputs.

{} It's a method of the class: WP_Block_Parser{}

No Hooks.




$WP_Block_Parser = new WP_Block_Parser();
$WP_Block_Parser->parse( $document );
$document(string) (required)
Input document being parsed.


Since 5.0.0 Introduced.

Code of WP_Block_Parser::parse() WP 5.8

function parse( $document ) {
	$this->document    = $document;
	$this->offset      = 0;
	$this->output      = array();
	$this->stack       = array();
	$this->empty_attrs = json_decode( '{}', true );

	do {
		// twiddle our thumbs.
	} while ( $this->proceed() );

	return $this->output;