On this page
wpdb::escape( string|array $data ): string|array
This method has been deprecated. Use wpdb::prepare() instead.
Do not use, deprecated.
Description
Use esc_sql() or wpdb::prepare() instead.
See also
Parameters
$datastring|array Required-
Data to escape.
Return
string|array Escaped data, in the same type as supplied.
Source
File: wp-includes/class-wpdb.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| wpdb::_weak_escape() wp-includes/class-wpdb.php | Do not use, deprecated. |
| wpdb::escape() wp-includes/class-wpdb.php | Do not use, deprecated. |
| _deprecated_function() wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
Used By
| Used By | Description |
|---|---|
| wpdb::escape() wp-includes/class-wpdb.php | Do not use, deprecated. |
Changelog
| Version | Description |
|---|---|
| 3.6.0 | Use wpdb::prepare() |
| 0.71 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wpdb/escape