get_http_origin

Get the HTTP Origin of the current request.

Description

(string) get_http_origin(); 

Returns (string)

URL of the origin. Empty string if no origin.


Usage

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

Defined (1)

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

/wp-includes/http.php  
  1. function get_http_origin() { 
  2. $origin = ''; 
  3. if ( ! empty ( $_SERVER[ 'HTTP_ORIGIN' ] ) ) 
  4. $origin = $_SERVER[ 'HTTP_ORIGIN' ]; 
  5.  
  6. /** 
  7. * Change the origin of an HTTP request. 
  8. * @since 3.4.0 
  9. * @param string $origin The original origin for the request. 
  10. */ 
  11. return apply_filters( 'http_origin', $origin );