wpdb::_escape( string|array $data ): string|array

In this article

Escapes data. Works on arrays.

Parameters

$datastring|arrayrequired
Data to escape.

Return

string|array Escaped data, in the same type as supplied.

Source

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;
}

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.