Title: WP_HTML_Open_Elements::count
Published: November 8, 2023
Last modified: February 24, 2026

---

# WP_HTML_Open_Elements::count(): int

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_html_open_elements/count/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_html_open_elements/count/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_html_open_elements/count/?output_format=md#changelog)

Returns how many nodes are currently in the stack of open elements.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_html_open_elements/count/?output_format=md#return)󠁿

 int How many node are in the stack of open elements.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_html_open_elements/count/?output_format=md#source)󠁿

    ```php
     */
    public function count(): int {
    	return count( $this->stack );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/html-api/class-wp-html-open-elements.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/html-api/class-wp-html-open-elements.php#L172)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/html-api/class-wp-html-open-elements.php#L172-L174)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_html_open_elements/count/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.4.0](https://developer.wordpress.org/reference/since/6.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_html_open_elements%2Fcount%2F)
before being able to contribute a note or feedback.