Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Strip param from URL
/**
* 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
You can’t perform that action at this time.