A WordPress-centric search engine for devs and theme authors



wp_magic_quotes ›

Since3.0.0
Deprecatedn/a
wp_magic_quotes ( No parameters )
Access:
  • private
Defined at:
Codex:

Add magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`.

Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE, or $_ENV are needed, use those superglobals directly.


Source

function wp_magic_quotes() {
	// Escape with wpdb.
	$_GET    = add_magic_quotes( $_GET );
	$_POST   = add_magic_quotes( $_POST );
	$_COOKIE = add_magic_quotes( $_COOKIE );
	$_SERVER = add_magic_quotes( $_SERVER );

	/*
	 * Revert the type change to string for two indexes which should retain their proper type.
	 * Among other things, this preserves compatibility of WP with PHPUnit Code Coverage generation.
	 */
	if ( isset( $_SERVER['REQUEST_TIME'] ) ) {
		$_SERVER['REQUEST_TIME'] = (int) $_SERVER['REQUEST_TIME'];
	}

	if ( isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ) {
		$_SERVER['REQUEST_TIME_FLOAT'] = (float) $_SERVER['REQUEST_TIME_FLOAT'];
	}

	// Force REQUEST to be GET + POST.
	$_REQUEST = array_merge( $_GET, $_POST );
}