WP_Block_Parser::parse
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.
Method of the class: WP_Block_Parser{}
No Hooks.
Returns
Array[].
Usage
$WP_Block_Parser = new WP_Block_Parser(); $WP_Block_Parser->parse( $document );
- $document(string) (required)
- Input document being parsed.
Changelog
| Since 5.0.0 | Introduced. |
WP_Block_Parser::parse() WP Block Parser::parse code WP 6.9.1
public function parse( $document ) {
$this->document = $document;
$this->offset = 0;
$this->output = array();
$this->stack = array();
while ( $this->proceed() ) {
continue;
}
return $this->output;
}