wp_get_original_referer() WordPress Function

wp_get_original_referer() is a function that allows you to get the original referring URL for a given request. This is useful for situations where you want to track where a user came from before they landed on your site.

wp_get_original_referer() #

Retrieve original referer that was posted, if it exists.


Return

(string|false) Original referer URL on success, false on failure.


Top ↑

More Information

HTTP referer is a server variable. ‘referer’ is deliberately miss-spelled.


Top ↑

Source

File: wp-includes/functions.php

function wp_get_original_referer() {
	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) ) {
		return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
	}

	return false;
}


Top ↑

Changelog

Changelog
VersionDescription
2.0.4Introduced.

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.

Show More
Show More