wpdb::escape_by_ref() WordPress Method
The wpdb::escape_by_ref() method is used to safely escape a string for use in a SQL query. This is especially important when using user-provided data in a SQL query, as it helps to prevent SQL injection attacks.
wpdb::escape_by_ref( string $string ) #
Escapes content by reference for insertion into the database, for security.
Parameters
- $string
(string)(Required)String to escape.
Source
File: wp-includes/wp-db.php
public function escape_by_ref( &$string ) {
if ( ! is_float( $string ) ) {
$string = $this->_real_escape( $string );
}
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |