Last active
September 26, 2019 12:29
-
-
Save justingreerbbi/46fa199954a7d15f8072eab43d078112 to your computer and use it in GitHub Desktop.
Custom WordPress OAuth Login Page for WP OAuth Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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