Skip to content

Instantly share code, notes, and snippets.

@justingreerbbi
Last active September 26, 2019 12:29
Show Gist options
  • Save justingreerbbi/46fa199954a7d15f8072eab43d078112 to your computer and use it in GitHub Desktop.
Save justingreerbbi/46fa199954a7d15f8072eab43d078112 to your computer and use it in GitHub Desktop.
Custom WordPress OAuth Login Page for WP OAuth Server
/**
* CUSTOM LOGIN REDIRECT
*
* Redirect a user to a custom login page for authentication
*/
add_action( 'wo_before_authorize_method', 'custom_login_redirect' );
function custom_login_redirect() {
if ( ! is_user_logged_in() ) {
wp_redirect( site_url() . '/custom-login?redirect_to=' . urlencode( site_url() . $_SERVER['REQUEST_URI'] ) );
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment