Title: class@anonymous::get_span
Published: February 24, 2026

---

# class@anonymous::get_span(): 󠀁[WP_HTML_Span](https://developer.wordpress.org/reference/classes/wp_html_span/)󠁿

## In this article

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

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

Gets the span for the current token.

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

 [WP_HTML_Span](https://developer.wordpress.org/reference/classes/wp_html_span/)
Current token span.

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

    ```php
    private function get_span(): WP_HTML_Span {
    	// Note: This call will never fail according to the usage of this class, given it is always called after ::next_tag() is true.
    	$this->set_bookmark( 'here' );
    	return $this->bookmarks['here'];
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/script-loader.php#L3777)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/script-loader.php#L3777-L3781)

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

| Used by | Description | 
| [class@anonymous::remove()](https://developer.wordpress.org/reference/classes/classanonymous/remove/)`wp-includes/script-loader.php` |

Removes the current token.

  | 
| [class@anonymous::insert_before()](https://developer.wordpress.org/reference/classes/classanonymous/insert_before/)`wp-includes/script-loader.php` |

Inserts text before the current token.

  | 
| [class@anonymous::insert_after()](https://developer.wordpress.org/reference/classes/classanonymous/insert_after/)`wp-includes/script-loader.php` |

Inserts text after the current token.

  |

## User Contributed Notes

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