Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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