Title: WP_HTML_Attribute_Token::__construct
Published: March 29, 2023
Last modified: February 24, 2026

---

# WP_HTML_Attribute_Token::__construct( string $name, int $value_start, int $value_length, int $start, int $length, bool $is_true )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_html_attribute_token/__construct/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_html_attribute_token/__construct/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_html_attribute_token/__construct/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_html_attribute_token/__construct/?output_format=md#changelog)

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

Constructor.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_html_attribute_token/__construct/?output_format=md#parameters)󠁿

 `$name`stringrequired

Attribute name.

`$value_start`intrequired

Attribute value.

`$value_length`intrequired

Number of bytes attribute value spans.

`$start`intrequired

The string offset where the attribute name starts.

`$length`intrequired

Byte length of the entire attribute name or name and value pair expression.

`$is_true`boolrequired

Whether the attribute is a boolean attribute with true value.

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

    ```php
    public function __construct( $name, $value_start, $value_length, $start, $length, $is_true ) {
    	$this->name            = $name;
    	$this->value_starts_at = $value_start;
    	$this->value_length    = $value_length;
    	$this->start           = $start;
    	$this->length          = $length;
    	$this->is_true         = $is_true;
    }
    ```

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

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

| Used by | Description | 
| [WP_HTML_Tag_Processor::parse_next_attribute()](https://developer.wordpress.org/reference/classes/wp_html_tag_processor/parse_next_attribute/)`wp-includes/html-api/class-wp-html-tag-processor.php` |

Parses the next attribute.

  |

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

| Version | Description | 
| [6.5.0](https://developer.wordpress.org/reference/since/6.5.0/) | Replaced `end` with `length` to more closely match `substr()`. | 
| [6.2.0](https://developer.wordpress.org/reference/since/6.2.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_attribute_token%2F__construct%2F)
before being able to contribute a note or feedback.