Automattic\WooCommerce\Internal\Admin\Orders

PageController::strip_http_referer()privateWC 1.0

Perform a redirect to remove the _wp_http_referer and _wpnonce strings if present in the URL (see also wp-admin/edit.php where a similar process takes place), otherwise the size of this field builds to an unmanageable length over time.

Method of the class: PageController{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->strip_http_referer(): void;

PageController::strip_http_referer() code WC 8.7.0

private function strip_http_referer(): void {
	$current_url  = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ?? '' ) );
	$stripped_url = remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), $current_url );

	if ( $stripped_url !== $current_url ) {
		wp_safe_redirect( $stripped_url );
		exit;
	}
}