# ugly_html_attributes()

Source: https://uglydev.com/docs/functions/ugly-html-attributes/
Updated: 19 November 2026

```php
ugly_html_attributes( array $attributes ): string
```

Builds the attributes of a tag, **each one escaped**: ` name="value" other="value"`. A `true` prints the bare attribute (`required`), a `false` leaves it out.

```php
echo '<input' . ugly_html_attributes( array(
	'type'     => 'text',
	'name'     => 'title',
	'required' => true,
	'disabled' => false,
) ) . '>';
// <input type="text" name="title" required>
```

It is made for [your own field types](https://uglydev.com/docs/hooks-and-filters/writing-your-own-field-type/), so the output is safe and it is clear that it is.
