esc_attr
Description
Escapes an ordinary value for a quoted HTML attribute.
Usage
Parameters
$string (string) (required) Attribute to be escaped.
Return Value
(string) Escaped HTML attribute after the esc_attr filter has been applied.
Example
$label = 'Save "draft" <now>';
echo '<button title="' . esc_attr(string: $label) . '">Save</button>';
// <button title="Save "draft" <now>">Save</button>
Always quote the surrounding attribute. This helper does not validate URL, CSS, JavaScript, or srcdoc attributes.