Title: WP_HTML_Processor::is_virtual
Published: July 16, 2024
Last modified: February 24, 2026

---

# WP_HTML_Processor::is_virtual(): bool

## In this article

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

[ Back to top](https://developer.wordpress.org/reference/classes/wp_html_processor/is_virtual/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Indicates if the currently-matched token is virtual, created by a stack operation
while processing HTML, rather than a token found in the HTML text itself.

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

 bool Whether the current token is virtual.

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

    ```php
    public function is_tag_closer(): bool {
    	return $this->is_virtual()
    		? ( WP_HTML_Stack_Event::POP === $this->current_element->operation && '#tag' === $this->get_token_type() )
    		: parent::is_tag_closer();
    }
    ```

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

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

| Version | Description | 
| [6.6.0](https://developer.wordpress.org/reference/since/6.6.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_processor%2Fis_virtual%2F)
before being able to contribute a note or feedback.