WP_HTML_Active_Formatting_Elements::remove_node( WP_HTML_Token $token ): bool

In this article

Removes a node from the stack of active formatting elements.

Parameters

$tokenWP_HTML_Tokenrequired
Remove this node from the stack, if it’s there already.

Return

bool Whether the node was found and removed from the stack of active formatting elements.

Source

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

Changelog

VersionDescription
6.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.