Escaping for HTML attributes.

Signature

esc_attr( $text )
text
 (string)

Return

(string)

Source

function esc_attr( $text ) {
	$safe_text = wp_check_invalid_utf8( $text );
	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
	return apply_filters( 'attribute_escape', $safe_text, $text );
}
WP Trac GitHub Bitbucket

Link here