WP_HTML_Processor::get_breadcrumbspublicWP 6.4.0

Computes the HTML breadcrumbs for the currently-matched node, if matched.

Breadcrumbs start at the outermost parent and descend toward the matched element. They always include the entire path from the root HTML node to the matched element.

Example:

$processor = WP_HTML_Processor::create_fragment( '<p><strong><em><img></em></strong></p>' );
$processor->next_tag( 'IMG' );
$processor->get_breadcrumbs() === array( 'HTML', 'BODY', 'P', 'STRONG', 'EM', 'IMG' );

Method of the class: WP_HTML_Processor{}

No Hooks.

Returns

String[]. Array of tag names representing path to matched node.

Usage

$WP_HTML_Processor = new WP_HTML_Processor();
$WP_HTML_Processor->get_breadcrumbs(): array;

Changelog

Since 6.4.0 Introduced.

WP_HTML_Processor::get_breadcrumbs() code WP 7.0

public function get_breadcrumbs(): array {
	return $this->breadcrumbs;
}