wp_get_referer

Retrieve referer from '_wp_http_referer' or HTTP referer.

Description

(string|bool) wp_get_referer(); 

Returns (string|bool)

False on failure. Referer URL on success.


Usage

  1. if ( !function_exists( 'wp_get_referer' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/backpress/functions.core.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_get_referer(); 
  7.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/backpress/functions.core.php  
  1. function wp_get_referer() { 
  2. $ref = ''; 
  3. if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) 
  4. $ref = $_REQUEST['_wp_http_referer']; 
  5. else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) 
  6. $ref = $_SERVER['HTTP_REFERER']; 
  7.  
  8. if ( $ref !== $_SERVER['REQUEST_URI'] ) 
  9. return $ref; 
  10. return false;