WP_HTML_Processor::is_tag_closer()publicWP 6.6.0

Indicates if the current tag token is a tag closer.

Example:

$p = WP_HTML_Processor::create_fragment( '<div></div>' );
$p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) );
$p->is_tag_closer() === false;
$p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) );
$p->is_tag_closer() === true;

Method of the class: WP_HTML_Processor{}

No Hooks.

Return

true|false. Whether the current tag is a tag closer.

Usage

$WP_HTML_Processor = new WP_HTML_Processor();
$WP_HTML_Processor->is_tag_closer();

Changelog

Since 6.6.0 Introduced.
Since 6.6.0 Subclassed for HTML Processor.

WP_HTML_Processor::is_tag_closer() code WP 6.6.2

public function is_tag_closer() {
	return $this->is_virtual()
		? ( WP_HTML_Stack_Event::POP === $this->current_element->operation && '#tag' === $this->get_token_type() )
		: parent::is_tag_closer();
}