W3cubDocs

/WordPress

WP_HTML_Processor::set_attribute( string $name, string|bool $value ): bool

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

Description

For boolean attributes special handling is provided:

  • When true is passed as the value, then only the attribute name is added to the tag.
  • When false is passed, the attribute gets removed if it existed before.

For string attributes, the value is escaped using the esc_attr function.

Parameters

$namestringrequired
The attribute name to target.
$valuestring|boolrequired
The new attribute value.

Return

bool Whether an attribute value was set.

Source

 */
case '-HEAD':
	$this->state->stack_of_open_elements->pop();

Changelog

Version Description
6.6.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_html_processor/set_attribute