Title: Replace WP-login
Last modified: June 27, 2018

---

# Replace WP-login

 *  Resolved [katering](https://wordpress.org/support/users/katering/)
 * (@katering)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/replace-wp-login/)
 * Hi folks
 * I managed to setup Ultimate Forum but now I do have a question regarding the 
   login-page. Whenever I try to login I see the default WordPress login page. How
   do I replace that with the Ultimate Forum login? I checked the link in the native
   login-page and it seems to be the correct ID.
 * Thanks a lot for your help
    kate
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Freplace-wp-login%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  [Mark Cutting](https://wordpress.org/support/users/mcutting/)
 * (@mcutting)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/replace-wp-login/#post-10461756)
 * Hi [@katering](https://wordpress.org/support/users/katering/),
 * There’s a couple of ways of doing this. My preferred approach is to use a function(
   you’d place this in your functions.php file for your theme) like the below
 *     ```
       add_action('init','set_redirect');
   
       function set_redirect(){
        global $pagenow;
        if( 'wp-login.php' == $pagenow ) {
         wp_redirect('YOUR CUSTOM PAGE URL');
         exit();
        }
       }
       ```
   
 * You’d replace “YOUR CUSTOM PAGE URL” with the actual URL you want to use.
 * Or, you can use this one
 *     ```
       // Hook the appropriate WordPress action
       add_action('init', 'prevent_wp_login');
   
       function prevent_wp_login() {
           // WP tracks the current page - global the variable to access it
           global $pagenow;
           // Check if a $_GET['action'] is set, and if so, load it into $action variable
           $action = (isset($_GET['action'])) ? $_GET['action'] : '';
           // Check if we're on the login page, and ensure the action is not 'logout'
           if( $pagenow == 'wp-login.php' && ( ! $action || ( $action && ! in_array($action, array('logout', 'lostpassword', 'rp', 'resetpass', 'register'))))) {
               // Load the home page url
               $page = get_bloginfo('url');
               // Redirect to the home page
               wp_redirect($page);
               // Stop execution to prevent the page loading for any reason
               exit();
           }
       }
       ```
   
 * In this case, I am redirecting all requests to the homepage, but this can be 
   any URL of your choosing.
 * Finally, you can disable wp-login.php if you are using UM to control the login
   and register process – you can still login and register without it.

Viewing 1 replies (of 1 total)

The topic ‘Replace WP-login’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

## Tags

 * [login](https://wordpress.org/support/topic-tag/login/)

 * 1 reply
 * 2 participants
 * Last reply from: [Mark Cutting](https://wordpress.org/support/users/mcutting/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/replace-wp-login/#post-10461756)
 * Status: resolved