WP_HTML_Open_Elements::contains()
Reports if a node of a given name is in the stack of open elements.
Method of the class: WP_HTML_Open_Elements{}
No Hooks.
Return
true|false
. Whether a node of the given name is in the stack of open elements.
Usage
$WP_HTML_Open_Elements = new WP_HTML_Open_Elements(); $WP_HTML_Open_Elements->contains( $node_name ): bool;
- $node_name(string) (required)
- Name of node for which to check.
Changelog
Since 6.7.0 | Introduced. |
WP_HTML_Open_Elements::contains() WP HTML Open Elements::contains code WP 6.7.1
public function contains( string $node_name ): bool { foreach ( $this->walk_up() as $item ) { if ( $node_name === $item->node_name ) { return true; } } return false; }