Skip to content

Instantly share code, notes, and snippets.

@nextendweb-laszlo
Last active August 17, 2021 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nextendweb-laszlo/3ecd8f235b1454a63e29e64350329e8c to your computer and use it in GitHub Desktop.
Save nextendweb-laszlo/3ecd8f235b1454a63e29e64350329e8c to your computer and use it in GitHub Desktop.
<?php
function excludeUrlFromFixedRedirect($fixedRedirectUrl, $provider) {
$pageWhereButtonWasClicked = NSL\Persistent\Persistent::get('redirect');
$excluded_url = 'https://example.com/checkout';
if ($pageWhereButtonWasClicked && strpos($pageWhereButtonWasClicked, $excluded_url) !== false) {
return false;
}
return $fixedRedirectUrl;
}
//excludes the URL from Fixed redirect url - for Login, when login happens with the Google provider
add_filter('google_login_redirect_url', 'excludeUrlFromFixedRedirect', 10, 2);
//excludes the URL from Fixed redirect url - for Register, when login happens with the Google provider
add_filter('google_register_redirect_url', 'excludeUrlFromFixedRedirect', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment