Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter mohamaddapper

    (@mohamaddapper)

    at this moment I installed ‘Theme My Login’ plugin to solve the problem temporarily (I mean this plugin redirect wp-loign to login) Until you help me for the main problem.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @mohamaddapper

    I suggest that you keep the redirection with the Theme My Login. The other way is to add a code for the redirection.

    Regards,

    Thread Starter mohamaddapper

    (@mohamaddapper)

    Can you please tell me what code I can use instead of this plugin?

    I got some problem with Theme My Login in translation! (even with loco plugin I can’t translate them!)

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @mohamaddapper

    Please try adding the following code snippets to your theme/child-theme’s functions.php file or use the Code Snippets plugin to run the code:

    add_action('init','um_102521_redirect_to_um_login');
    function um_102521_redirect_to_um_login(){
         global $pagenow;
         if( ! function_exists("um_get_core_page" ) ) return;
    
         if( 'wp-login.php' == $pagenow ) {
            wp_redirect( um_get_core_page("login") );
            exit();
         }
    }

    Regards,

    Thread Starter mohamaddapper

    (@mohamaddapper)

    I have used this code before.

    this code redirects wp-login.php page to /login/ that clears the previous path.

    I mean when I want to go to ‘test.com/dashboard’ it goes to ‘test.com/login’ then Can not take me back to the previous address!

    while ‘Theme My Login’ takes me back to the previous address like this:

    I go to this link:

    1. https://test.com/dashboard/

    and then it happens

    2. https://test.com/login/?redirect_to=https%3A%2F%2Ftest.com%2Fdashboard%2F

    How can I get this without ‘Theme My Login’?

    This was just an example. I want any page that requires user login, go through Ultimate Member Login Page not wp-login! and then go back to previous page.

    Thanks

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @mohamaddapper

    Please try this one:

    add_action('init','um_102521_redirect_to_um_login');
    function um_102521_redirect_to_um_login(){
         global $pagenow;
         if( ! function_exists("um_get_core_page" ) ) return;
    
         if( 'wp-login.php' == $pagenow ) {
            $redirect_to = '';
            if( isset( $_REQUEST['redirect_to'] ) ){
                  $redirect_to = "?redirect_to=".$_REQUEST['redirect_to'];
            }  
            wp_redirect( um_get_core_page("login") . $redirect_to );
            exit();
         }
    }

    Regards,

    • This reply was modified 2 years, 11 months ago by Champ Camba.
    Thread Starter mohamaddapper

    (@mohamaddapper)

    Result:

    click on Dashboard:

    https:/test.com/dashboard/

    Next:

    https:/test.com/login/https:/test.com/dashboard/

    and I got a 404 page (Not Found)

    So this code doesn’t work

    • This reply was modified 2 years, 11 months ago by mohamaddapper.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @mohamaddapper

    I’ve updated the code. Maybe you received a notification with the old code. Please see the updated code above in the topic.

    Regards,

    Thread Starter mohamaddapper

    (@mohamaddapper)

    Yes It worked ??
    Thanks a lot

    Can you please tell me a solution for this too?

    in my site when I click on logout button

    *https://test.com/wp-login.php?action=logout&_wpnonce=023fce2d77*

    it redirects to *https://test.com/login* Showing some details about my account (photo, name, account, logout)

    then I have to click on logout button (https://test.com/logout/?redirect_to=https://test.com/login/) again to logout from my account.

    How can I remove this page (https://test.com/login) from the path?

    • This reply was modified 2 years, 11 months ago by mohamaddapper.
    • This reply was modified 2 years, 11 months ago by mohamaddapper.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @mohamaddapper

    Please try this one:

    add_action('init','um_102521_redirect_to_um_login');
    function um_102521_redirect_to_um_login(){
         global $pagenow;
         if( ! function_exists("um_get_core_page" ) ) return;
         if( isset( $_REQUEST['action'] ) && "logout" == $_REQUEST['action'] ) return;
    
         if( 'wp-login.php' == $pagenow ) {
            $redirect_to = '';
            if( isset( $_REQUEST['redirect_to'] ) ){
                  $redirect_to = "?redirect_to=".$_REQUEST['redirect_to'];
            }  
            wp_redirect( um_get_core_page("login") . $redirect_to );
            exit();
         }
    }

    Regards,

    Thread Starter mohamaddapper

    (@mohamaddapper)

    Thanks a lot. It Works Well

    Thank you very much again

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know.

    Regards,

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘redirect to wp-login.php!’ is closed to new replies.