Created
April 17, 2018 10:47
-
-
Save inquota/f255fcdd4f8ed2637c3546f8f03ff716 to your computer and use it in GitHub Desktop.
Strip param from URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Strip referer param from URL. | |
* | |
* @param string $request_uri | |
* | |
* @return string | |
*/ | |
public function get_url_without_referer( $request_uri ) { | |
$path = parse_url( $request_uri, PHP_URL_PATH ); | |
$query_string = parse_url( $request_uri, PHP_URL_QUERY ); | |
parse_str( $query_string, $output ); | |
unset( $output['referer'] ); | |
$query_string = urldecode( http_build_query( $output ) ); | |
return get_home_url( null, $path . '?' . $query_string ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment