get_http_origin() WordPress Function
The get_http_origin() function is used to get the current URL of the website. This is useful for making sure that the website is being accessed from the correct URL.
get_http_origin() #
Get the HTTP Origin of the current request.
Return
(string) URL of the origin. Empty string if no origin.
Source
File: wp-includes/http.php
function get_http_origin() {
$origin = '';
if ( ! empty( $_SERVER['HTTP_ORIGIN'] ) ) {
$origin = $_SERVER['HTTP_ORIGIN'];
}
/**
* Change the origin of an HTTP request.
*
* @since 3.4.0
*
* @param string $origin The original origin for the request.
*/
return apply_filters( 'http_origin', $origin );
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |