Escapes text for SQL LIKE special characters % and _.

Signature

like_escape( $text )
text
 (string) The text to be escaped.

Return

(string) text, safe for inclusion in LIKE query.

Source

function like_escape($text) {
	return str_replace(array("%", "_"), array("\\%", "\\_"), $text);
}
WP Trac GitHub

Link here