Title: WP_Interactivity_API_Directives_Processor::has_and_visits_its_closer_tag
Published: April 3, 2024
Last modified: August 20, 2026

---

# WP_Interactivity_API_Directives_Processor::has_and_visits_its_closer_tag(): bool

## In this article

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

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.

Checks whether the current tag has and will visit its matching closer tag.

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

 bool Whether the current tag has a closer tag.

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

    ```php
    public function has_and_visits_its_closer_tag(): bool {
    	$tag_name = $this->get_tag();

    	return null !== $tag_name && (
    		! WP_HTML_Processor::is_void( $tag_name ) &&
    		! in_array( $tag_name, self::TAGS_THAT_DONT_VISIT_CLOSER_TAG, true )
    	);
    }
    ```

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

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

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

Returns whether a given element is an HTML Void Element

  |

| Used by | Description | 
| [WP_Interactivity_API_Directives_Processor::next_balanced_tag_closer_tag()](https://developer.wordpress.org/reference/classes/wp_interactivity_api_directives_processor/next_balanced_tag_closer_tag/)`wp-includes/interactivity-api/class-wp-interactivity-api-directives-processor.php` |

Finds the matching closing tag for an opening tag.

  |

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

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

## User Contributed Notes

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