WP_HTML_Tag_Processor::get_tag()publicWP 6.2.0

Returns the uppercase name of the matched tag.

Example:

$p = new WP_HTML_Tag_Processor( '<div class="test">Test</div>' );
$p->next_tag() === true;
$p->get_tag() === 'DIV';
$p->next_tag() === false;
$p->get_tag() === null;

Метод класса: WP_HTML_Tag_Processor{}

Хуков нет.

Возвращает

Строку|null. Name of currently matched tag in input HTML, or null if none found.

Использование

$WP_HTML_Tag_Processor = new WP_HTML_Tag_Processor();
$WP_HTML_Tag_Processor->get_tag();

Список изменений

С версии 6.2.0 Введена.

Код WP_HTML_Tag_Processor::get_tag() WP 6.3.1

public function get_tag() {
	if ( null === $this->tag_name_starts_at ) {
		return null;
	}

	$tag_name = substr( $this->html, $this->tag_name_starts_at, $this->tag_name_length );

	return strtoupper( $tag_name );
}