addslashes_gpc() WordPress Function
The addslashes_gpc() function in WordPress is used to escape strings. It is used to prevent SQL injection attacks by adding backslashes before characters that need to be escaped.
addslashes_gpc( string|array $gpc ) #
Adds slashes to a string or recursively adds slashes to strings within an array.
Description
Slashes will first be removed if magic_quotes_gpc is set, see https://www.php.net/magic_quotes for more details.
Parameters
- $gpc
(string|array)(Required)String or array of data to slash.
Return
(string|array) Slashed $gpc
.
Source
File: wp-includes/formatting.php
function addslashes_gpc( $gpc ) { return wp_slash( $gpc ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
0.71 | Introduced. |