WP_HTML_Active_Formatting_Elements::remove_node()publicWP 6.4.0

Removes a node from the stack of active formatting elements.

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

Хуков нет.

Возвращает

true|false. Whether the node was found and removed from the stack of active formatting elements.

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

$WP_HTML_Active_Formatting_Elements = new WP_HTML_Active_Formatting_Elements();
$WP_HTML_Active_Formatting_Elements->remove_node( $token );
$token(WP_HTML_Token) (обязательный)
Remove this node from the stack, if it's there already.

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

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

Код WP_HTML_Active_Formatting_Elements::remove_node() WP 6.6.2

public function remove_node( $token ) {
	foreach ( $this->walk_up() as $position_from_end => $item ) {
		if ( $token->bookmark_name !== $item->bookmark_name ) {
			continue;
		}

		$position_from_start = $this->count() - $position_from_end - 1;
		array_splice( $this->stack, $position_from_start, 1 );
		return true;
	}

	return false;
}