Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.