wp_magic_quotes

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

Description

wp_magic_quotes(); 

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


Usage

  1. if ( !function_exists( 'wp_magic_quotes' ) ) { 
  2. require_once ABSPATH . WPINC . '/load.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_magic_quotes(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/load.php  
  1. function wp_magic_quotes() { 
  2. // If already slashed, strip. 
  3. if ( get_magic_quotes_gpc() ) { 
  4. $_GET = stripslashes_deep( $_GET ); 
  5. $_POST = stripslashes_deep( $_POST ); 
  6. $_COOKIE = stripslashes_deep( $_COOKIE ); 
  7.  
  8. // Escape with wpdb. 
  9. $_GET = add_magic_quotes( $_GET ); 
  10. $_POST = add_magic_quotes( $_POST ); 
  11. $_COOKIE = add_magic_quotes( $_COOKIE ); 
  12. $_SERVER = add_magic_quotes( $_SERVER ); 
  13.  
  14. // Force REQUEST to be GET + POST. 
  15. $_REQUEST = array_merge( $_GET, $_POST );