Escapes data for use in a MySQL query.

Usually you should prepare queries using wpdb::prepare(). Sometimes, spot-escaping is required or useful. One example is preparing an array for use in an IN clause.

Signature

esc_sql( $data )
data
 (string|array) Unescaped data

Return

(string|array) Escaped data

Source

function esc_sql( $data ) {
	global $wpdb;
	return $wpdb->_escape( $data );
}
WP Trac GitHub

Link here