wp_unregister_GLOBALS

Turn register globals off.

Description

wp_unregister_GLOBALS(); 

Usage

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

Defined (1)

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

/wp-includes/load.php  
  1. function wp_unregister_GLOBALS() { 
  2. if ( !ini_get( 'register_globals' ) ) 
  3. return; 
  4.  
  5. if ( isset( $_REQUEST['GLOBALS'] ) ) 
  6. die( 'GLOBALS overwrite attempt detected' ); 
  7.  
  8. // Variables that shouldn't be unset 
  9. $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' ); 
  10.  
  11. $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() ); 
  12. foreach ( $input as $k => $v ) 
  13. if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) { 
  14. unset( $GLOBALS[$k] );