• Resolved Ben Konyn

    (@bkonyn)


    Hey – wanted to get an opinion.
    I want users to login and register on the TML pages.
    But there are links on my site to /wp-login.php all over the place.
    If i use the disable wp-login.php option it breaks all those links.

    Would there be any downside or problem in putting this code at line 100 on modules/security/security.php?

    if ($_REQUEST['action'] == "register") 
    {    wp_safe_redirect( "/register"); exit;
    }
    wp_safe_redirect( "/login"); exit;

    That way instead of 404 it redirect to the TML page.
    Also is there any way to know the correct url for the TML logon page in case someone changes it from /login and /register ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    Any plugin modifications would be lost upon updating the plugin. I would just not use TML’s “Disable wp-login.php” feature, and roll your own.

    
    function redirect_wp_login() {
        global $pagenow;
    
        if ( 'wp-login.php' == $pagenow ) {
            $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login';
            $link = Theme_My_Login::get_object()->get_page_link( $action );
            wp_redirect( $link );
            exit;
        }
    }
    add_action( 'init', 'redirect_wp_login' );
    
    Thread Starter Ben Konyn

    (@bkonyn)

    That’s a great way of doing it – does just what I needed – thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Diable wp-login.php 404 error – better plan?’ is closed to new replies.