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

---

# WP_Interactivity_API_Directives_Processor::skip_to_tag_closer(): bool

## In this article

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

[ Back to top](https://developer.wordpress.org/reference/classes/wp_interactivity_api_directives_processor/skip_to_tag_closer/?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.

Skips processing the content between tags.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_interactivity_api_directives_processor/skip_to_tag_closer/?output_format=md#description)󠁿

It positions the cursor in the closer tag of the foreign element, if it exists.

This function is intended to skip processing SVG and MathML inner content instead
of bailing out the whole processing.

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

 bool Whether the foreign content was successfully skipped.

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

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

    	while ( $depth > 0 && $this->next_tag( array( 'tag_closers' => 'visit' ) ) ) {
    		if ( ! $this->is_tag_closer() && $this->get_attribute_names_with_prefix( 'data-wp-' ) ) {
    			/* translators: 1: SVG or MATH HTML tag. */
    			$message = sprintf( __( 'Interactivity directives were detected inside an incompatible %1$s tag. These directives will be ignored in the server side render.' ), $tag_name );
    			_doing_it_wrong( __METHOD__, $message, '6.6.0' );
    		}
    		if ( $this->get_tag() === $tag_name ) {
    			if ( $this->has_self_closing_flag() ) {
    				continue;
    			}
    			$depth += $this->is_tag_closer() ? -1 : 1;
    		}
    	}

    	return 0 === $depth;
    }
    ```

[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#L200)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/interactivity-api/class-wp-interactivity-api-directives-processor.php#L200-L219)

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

| Uses | Description | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [_doing_it_wrong()](https://developer.wordpress.org/reference/functions/_doing_it_wrong/)`wp-includes/functions.php` |

Marks something as being incorrectly called.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_interactivity_api_directives_processor/skip_to_tag_closer/?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%2Fskip_to_tag_closer%2F)
before being able to contribute a note or feedback.