function wp_get_referer() { // Return early if called before wp_validate_redirect() is defined.
if ( !
function_exists( 'wp_validate_redirect'
) ) { return false;
} $ref =
wp_get_raw_referer();
if ( $ref &&
wp_unslash( $_SERVER['REQUEST_URI'
] ) !==
$ref &&
home_url() .
wp_unslash( $_SERVER['REQUEST_URI'
] ) !==
$ref ) { return wp_validate_redirect( $ref, false
);
} return false;
}/**
* Retrieves unvalidated referer from the '_wp_http_referer' URL query variable or the HTTP referer.
*
* If the value of the '_wp_http_referer' URL query variable is not a string then it will be ignored.
*
* Do not use for redirects, use wp_get_referer() instead.
*
* @since 4.5.0
*
* @return string|false Referer URL on success, false on failure.
*/