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.


Top ↑

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 );
}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.