Functions
ugly_html_attributes()
ugly_html_attributes( array $attributes ): stringBuilds the attributes of a tag, each one escaped: name="value" other="value". A true prints the bare attribute (required), a false leaves it out.
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, so the output is safe and it is clear that it is.
Did this article answer your question?
Thank you. It helps us make the documentation better. Need more help?