WP_Block_Parser::parse

Advertisement

Summery Summery

Parses a document and returns a list of block structures

Syntax Syntax

WP_Block_Parser::parse( string $document )

Description Description

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.

Parameters Parameters

$document

(string) (Required) Input document being parsed.

Return Return

(WP_Block_Parser_Block[])

Source Source

File: wp-includes/class-wp-block-parser.php

	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;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
3.8.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.