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.


Top ↑

Source

File: wp-includes/wp-db.php

	public function escape_by_ref( &$string ) {
		if ( ! is_float( $string ) ) {
			$string = $this->_real_escape( $string );
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
2.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.