WP_HTML_Open_Elements::pop_until()
Pops nodes off of the stack of open elements until one with the given tag name has been popped.
Method of the class: WP_HTML_Open_Elements{}
No Hooks.
Return
true|false
. Whether a tag of the given name was found and popped off of the stack of open elements.
Usage
$WP_HTML_Open_Elements = new WP_HTML_Open_Elements(); $WP_HTML_Open_Elements->pop_until( $tag_name );
- $tag_name(string) (required)
- Name of tag that needs to be popped off of the stack of open elements.
Notes
Changelog
Since 6.4.0 | Introduced. |
WP_HTML_Open_Elements::pop_until() WP HTML Open Elements::pop until code WP 6.6.2
public function pop_until( $tag_name ) { foreach ( $this->walk_up() as $item ) { if ( 'context-node' === $item->bookmark_name ) { return true; } $this->pop(); if ( '(internal: H1 through H6 - do not use)' === $tag_name && in_array( $item->node_name, array( 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' ), true ) ) { return true; } if ( $tag_name === $item->node_name ) { return true; } } return false; }