wp_get_raw_referer

Retrieves unvalidated referer from '_wp_http_referer' or HTTP referer.

Description

(string|false) wp_get_raw_referer(); 

Do not use for redirects, use wp_get_referer() instead.

Returns (string|false)

Referer URL on success, false on failure.


Usage

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

Defined (1)

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

/wp-includes/functions.php  
  1. function wp_get_raw_referer() { 
  2. if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { 
  3. return wp_unslash( $_REQUEST['_wp_http_referer'] ); 
  4. } else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { 
  5. return wp_unslash( $_SERVER['HTTP_REFERER'] ); 
  6.  
  7. return false;