On this page
wpdb::_escape( string|array $data ): string|array
Escapes data. Works on arrays.
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 ( is_array( $data ) ) {
foreach ( $data as $k => $v ) {
if ( is_array( $v ) ) {
$data[ $k ] = $this->_escape( $v );
} else {
$data[ $k ] = $this->_real_escape( $v );
}
}
} else {
$data = $this->_real_escape( $data );
}
return $data;
}
Related
Uses
| Uses | Description |
|---|---|
| wpdb::_escape() wp-includes/class-wpdb.php | Escapes data. Works on arrays. |
| wpdb::_real_escape() wp-includes/class-wpdb.php | Real escape, using mysqli_real_escape_string() or mysql_real_escape_string(). |
Used By
| Used By | Description |
|---|---|
| WP_Network_Query::get_network_ids() wp-includes/class-wp-network-query.php | Used internally to get a list of network IDs matching the query vars. |
| WP_Site_Query::get_site_ids() wp-includes/class-wp-site-query.php | Used internally to get a list of site IDs matching the query vars. |
| esc_sql() wp-includes/formatting.php | Escapes data for use in a MySQL query. |
| wpdb::_escape() wp-includes/class-wpdb.php | Escapes data. Works on arrays. |
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wpdb/_escape