function wp_get_referer() {}

Retrieve referer from ‘_wp_http_referer’ or HTTP referer. If it’s the same as the current request URL, will return false.

Return values

returns:False on failure. Referer URL on success.

Source code

function wp_get_referer() {

	$ref = false;

	if ( ! empty( $_REQUEST['_wp_http_referer'] ) )

		$ref = $_REQUEST['_wp_http_referer'];

	else if ( ! empty( $_SERVER['HTTP_REFERER'] ) )

		$ref = $_SERVER['HTTP_REFERER'];

	if ( $ref && $ref !== $_SERVER['REQUEST_URI'] )

		return $ref;

	return false;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: