Home / Admin / WPForms Login Page Redirect
Duplicate Snippet

Embed Snippet on Your Site

WPForms Login Page Redirect

This snippet will redirect the default WordPress login page to your custom login page. This makes it so that anyone who tries to access the default WordPress login page will be sent to your new one instead.

100+
Code Preview
php
<?php
/* 
Modify the login URL to redirect to a custom login page.
Original doc link: https://wpforms.com/how-to-create-a-custom-login-form-for-improved-site-branding/
For support, please visit: https://www.facebook.com/groups/wpformsvip
*/
function sulliesflowers_custom_login_url( $login_url, $redirect, $force_reauth ) {
    // Change here your login page url
    $login_url = 'https://sulliesflowers.com/login/';
    
    if ( ! empty( $redirect ) ) {
        $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );
    }
    if ( $force_reauth ) {
        $login_url = add_query_arg( 'reauth', '1', $login_url );
    }
    return $login_url;
}
add_filter( 'login_url', 'sulliesflowers_custom_login_url', 10, 3 );

Comments

Add a Comment