wp_get_original_referer(): string|false

Retrieves original referer that was posted, if it exists.

Return

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

More Information

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

Source

function wp_get_original_referer() {
	// Return early if called before wp_validate_redirect() is defined.
	if ( ! function_exists( 'wp_validate_redirect' ) ) {
		return false;
	}

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

	return false;
}

Changelog

VersionDescription
2.0.4Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.