3rd Party Integration

Custom Login Page

Published: August 14, 2019 | Updated: December 29th, 2019
  1. Home
  2. Docs
  3. How To
  4. Custom Login Page


The WP OAuth Server plugin allows for you have a custom login page and still provide OAuth services.

 * 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'] ) );

Applying the Custom Login Code

Extending WP OAuth Server can be done via the current themes functions file. Read more about the functionality of a themes function file by visiting https://developer.wordpress.org/themes/basics/theme-functions/.

Place the snippet from above in your functions.php file. You may need to change the parameter for redirect to work with your custom needs.