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)
 * [Related](https://developer.wordpress.org/reference/classes/wp_html_processor/is_virtual/?output_format=md#related)
 * [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
    private function is_virtual(): bool {
    	return (
    		isset( $this->current_element->provenance ) &&
    		'virtual' === $this->current_element->provenance
    	);
    }
    ```

[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/6.9.4/src/wp-includes/html-api/class-wp-html-processor.php#L884)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/html-api/class-wp-html-processor.php#L884-L889)

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

| Used by | Description | 
| [WP_HTML_Processor::get_comment_type()](https://developer.wordpress.org/reference/classes/wp_html_processor/get_comment_type/)`wp-includes/html-api/class-wp-html-processor.php` |

Indicates what kind of comment produced the comment node.

  | 
| [WP_HTML_Processor::remove_class()](https://developer.wordpress.org/reference/classes/wp_html_processor/remove_class/)`wp-includes/html-api/class-wp-html-processor.php` |

Removes a class name from the currently matched tag.

  | 
| [WP_HTML_Processor::has_class()](https://developer.wordpress.org/reference/classes/wp_html_processor/has_class/)`wp-includes/html-api/class-wp-html-processor.php` |

Returns if a matched tag contains the given ASCII case-insensitive class name.

  | 
| [WP_HTML_Processor::class_list()](https://developer.wordpress.org/reference/classes/wp_html_processor/class_list/)`wp-includes/html-api/class-wp-html-processor.php` |

Generator for a foreach loop to step through each class name for the matched tag.

  | 
| [WP_HTML_Processor::get_modifiable_text()](https://developer.wordpress.org/reference/classes/wp_html_processor/get_modifiable_text/)`wp-includes/html-api/class-wp-html-processor.php` |

Returns the modifiable text for a matched token, or an empty string.

  | 
| [WP_HTML_Processor::get_attribute()](https://developer.wordpress.org/reference/classes/wp_html_processor/get_attribute/)`wp-includes/html-api/class-wp-html-processor.php` |

Returns the value of a requested attribute from a matched tag opener if that attribute exists.

  | 
| [WP_HTML_Processor::remove_attribute()](https://developer.wordpress.org/reference/classes/wp_html_processor/remove_attribute/)`wp-includes/html-api/class-wp-html-processor.php` |

Remove an attribute from the currently-matched tag.

  | 
| [WP_HTML_Processor::add_class()](https://developer.wordpress.org/reference/classes/wp_html_processor/add_class/)`wp-includes/html-api/class-wp-html-processor.php` |

Adds a new class name to the currently matched tag.

  | 
| [WP_HTML_Processor::set_attribute()](https://developer.wordpress.org/reference/classes/wp_html_processor/set_attribute/)`wp-includes/html-api/class-wp-html-processor.php` |

Updates or creates a new attribute on the currently matched tag with the passed value.

  | 
| [WP_HTML_Processor::get_attribute_names_with_prefix()](https://developer.wordpress.org/reference/classes/wp_html_processor/get_attribute_names_with_prefix/)`wp-includes/html-api/class-wp-html-processor.php` |

Gets lowercase names of all attributes matching a given prefix in the current tag.

  | 
| [WP_HTML_Processor::has_self_closing_flag()](https://developer.wordpress.org/reference/classes/wp_html_processor/has_self_closing_flag/)`wp-includes/html-api/class-wp-html-processor.php` |

Indicates if the currently matched tag contains the self-closing flag.

  | 
| [WP_HTML_Processor::get_token_name()](https://developer.wordpress.org/reference/classes/wp_html_processor/get_token_name/)`wp-includes/html-api/class-wp-html-processor.php` |

Returns the node name represented by the token.

  | 
| [WP_HTML_Processor::get_token_type()](https://developer.wordpress.org/reference/classes/wp_html_processor/get_token_type/)`wp-includes/html-api/class-wp-html-processor.php` |

Indicates the kind of matched token, if any.

  | 
| [WP_HTML_Processor::is_tag_closer()](https://developer.wordpress.org/reference/classes/wp_html_processor/is_tag_closer/)`wp-includes/html-api/class-wp-html-processor.php` |

Indicates if the current tag token is a tag closer.

  | 
| [WP_HTML_Processor::seek()](https://developer.wordpress.org/reference/classes/wp_html_processor/seek/)`wp-includes/html-api/class-wp-html-processor.php` |

Moves the internal cursor in the HTML Processor to a given bookmark’s location.

  | 
| [WP_HTML_Processor::set_bookmark()](https://developer.wordpress.org/reference/classes/wp_html_processor/set_bookmark/)`wp-includes/html-api/class-wp-html-processor.php` |

Sets a bookmark in the HTML document.

  | 
| [WP_HTML_Processor::get_tag()](https://developer.wordpress.org/reference/classes/wp_html_processor/get_tag/)`wp-includes/html-api/class-wp-html-processor.php` |

Returns the uppercase name of the matched tag.

  |

[Show 12 more](https://developer.wordpress.org/reference/classes/wp_html_processor/is_virtual/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_html_processor/is_virtual/?output_format=md#)

## 󠀁[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.