WordPress at a glance
function is not described

wpdb::escape() public WP 0.71

Deprecated in from version 3.6.0. It is no longer supported and can be removed in future releases. Use wpdb::prepare() instead.

Do not use, deprecated.

Use esc_sql() or wpdb::prepare() instead.

{} It's a method of the class: wpdb{}

No Hooks.

Return

String/Array. Escaped data, in the same type as supplied.

Usage

global $wpdb;
$wpdb->escape( $data );
$data(string/array) (required)
Data to escape.

Notes

  • See: wpdb::prepare()
  • See: esc_sql()

Changelog

Since 0.71 Introduced.
Deprecated Since 3.6.0 Use wpdb::prepare()

Code of wpdb::escape() WP 5.5.2

<?php
public function escape( $data ) {
	if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) ) {
		_deprecated_function( __METHOD__, '3.6.0', 'wpdb::prepare() or esc_sql()' );
	}
	if ( is_array( $data ) ) {
		foreach ( $data as $k => $v ) {
			if ( is_array( $v ) ) {
				$data[ $k ] = $this->escape( $v, 'recursive' );
			} else {
				$data[ $k ] = $this->_weak_escape( $v, 'internal' );
			}
		}
	} else {
		$data = $this->_weak_escape( $data, 'internal' );
	}

	return $data;
}