Skip to content

Commit

Permalink
Tweak URL generation before redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Jun 22, 2015
1 parent eb4cbaf commit 9adbdd4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion includes/class-wc-cache-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ public static function geolocation_ajax_redirect() {
$current_hash = isset( $_GET['v'] ) ? wc_clean( $_GET['v'] ) : '';
if ( empty( $current_hash ) || $current_hash !== $location_hash ) {
global $wp;
wp_safe_redirect( esc_url_raw( add_query_arg( 'v', $location_hash, remove_query_arg( array( 'v', 'pagename' ), add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) ) ) ) ), 307 );

$redirect_url = trailingslashit( home_url( $wp->request ) );

if ( ! get_option( 'permalink_structure' ) ) {
$redirect_url = add_query_arg( $wp->query_string, '', $redirect_url );
}

$redirect_url = add_query_arg( 'v', $location_hash, remove_query_arg( 'v', $redirect_url ) );

wp_safe_redirect( esc_url_raw( $redirect_url ), 307 );
exit;
}
}
Expand Down

0 comments on commit 9adbdd4

Please sign in to comment.