Skip to content

Instantly share code, notes, and snippets.

@joshcanhelp
Created March 29, 2018 17:55
Show Gist options
  • Save joshcanhelp/e3eb693749f0fe66aad097c3bbb3b415 to your computer and use it in GitHub Desktop.
Save joshcanhelp/e3eb693749f0fe66aad097c3bbb3b415 to your computer and use it in GitHub Desktop.
Append a cache-breaking parameter to login_url redirects
/**
* Append a cache-breaking parameter to login_url redirects
*
* @param string $login_url
* @param string $redirect
*
* @return string
*/
function wp_auth0_gist_cache_break_redirect_to( $login_url, $redirect ) {
if ( ! empty( $redirect ) ) {
$login_url = remove_query_arg( 'redirect_to', $login_url );
$redirect = add_query_arg( 'logged_in', 1, $redirect );
$redirect = urlencode( $redirect );
$login_url = add_query_arg( 'redirect_to', $redirect, $login_url );
}
return $login_url;
}
add_filter( 'login_url', 'wp_auth0_gist_cache_break_redirect_to', 10, 2 );
@Thanh12561
Copy link

@Thanh12561
Copy link

Thanh788

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment