Skip to content

Commit

Permalink
Merge pull request #4 from newfold-labs/fix/redirect-url
Browse files Browse the repository at this point in the history
Unset `action` and use `add_query_arg()` to properly add query args.
  • Loading branch information
wpscholar authored Jul 15, 2022
2 parents a67c88f + d2faf8f commit ce753f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion includes/SSO_Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public static function getSuccessUrl() {
if ( $url ) {
$params = $_GET;

unset( $params['action'] );
unset( $params['bounce'] );
unset( $params['nonce'] );
unset( $params['redirect'] );
Expand All @@ -200,7 +201,12 @@ public static function getSuccessUrl() {
unset( $params['user'] );

// Persist all query params not used for SSO
$url .= $params ? '?' . http_build_query( $params ) : '';
if ( ! empty( $params ) ) {
foreach ( $params as $key => $value ) {
$url = add_query_arg( $key, $value, $url );
}
}

}

if ( ! $url ) {
Expand Down

0 comments on commit ce753f8

Please sign in to comment.