Support is monitored from Monday to Saturday in office hours from the GMT timezone. Our response time can be up to 2 business days.

Notice: We do not accept any customization. Please Read Envato Support Policy. But we still can help with little snippets if that's possible!

Okay
  Print

How to redirect Wordpress WP Login to Youzer Login?​​

Please use this snippet

/**
 * Redirect "wp-login.php" Page To Youzer Login Page.
 */
function yz_redirect_wplogin_to_youzer_login_page() {
    
    if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'logout' || $_GET['action'] == 'lostpassword' || $_GET['action'] == 'rp' || $_GET['action'] == 'bp-resend-activation' ) ) {
        return;
    }
    global $pagenow;
    
    if ( 'wp-login.php' == $pagenow && $_SERVER['REQUEST_METHOD'] == 'GET' ) {
        // Get Login Page Url.
        $login_url = 'add-your-custom-login-page-url-here';
        // Redirect !!
        wp_redirect( $login_url );
        exit();
    }
}
add_action( 'init', 'yz_redirect_wplogin_to_youzer_login_page' );

PS: