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.


Top ↑

Parameters

$gpc

(string|array)(Required)String or array of data to slash.


Top ↑

Return

(string|array) Slashed $gpc.


Top ↑

Source

File: wp-includes/formatting.php

function addslashes_gpc( $gpc ) {
	return wp_slash( $gpc );
}


Top ↑

Changelog

Changelog
VersionDescription
0.71Introduced.

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.

Show More