Skip to content

Instantly share code, notes, and snippets.

@dancameron
Created September 18, 2013 21:48
Show Gist options
  • Select an option

  • Save dancameron/6616252 to your computer and use it in GitHub Desktop.

Select an option

Save dancameron/6616252 to your computer and use it in GitHub Desktop.
redirect non logged in users away from checkout
add_action( 'template_redirect', 'redirect_away_from_checkout' );
function redirect_away_from_checkout() {
if ( !is_user_logged_in() && gb_on_checkout_page() ) {
wp_redirect( add_query_arg( array( 'redirect_to' => gb_get_checkout_url() ), gb_get_account_login_url() ) );
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment