Home Forums WoodMart support forum How can redirect user to another url as a login page?

How can redirect user to another url as a login page?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #413929

    metechofficial
    Participant

    I need something similiar to the one like you gave on https://xtemos.com/forums/topic/how-can-i-redirect-the-user-in-other-url-when-he-click-create-an-accound/#new-post

    but I need it for a login page.

    I have created an another login form. So when a user logged in and logout it directs them to http://www.fitovision.net/hesabim which is normal but I want them to be redirected to fitovision.net/login page instead of wordpress default login page.

    Is there any function for that?

    I found one but it redirects the user to user profile page not my account.

    The code I found is:

    
    function redirect_login_page(){
            if(is_user_logged_in()){
                return;
            }
            global $post;
            // Need for checking if this page equals wp-login.php
            
            // permalink to the custom login page
            $login_page  = get_permalink( '9255' );
          
            if( has_shortcode($post->post_content, "woocommerce_my_account") ) {
                wp_redirect( $login_page );
                exit();
            }
        }
    
    add_action( 'template_redirect','redirect_login_page' );
    #414357

    Luke Nielsen
    Keymaster

    Hello,

    Please try to use the below code, enter it into the functions.php file in your child theme.

    add_filter( 'woodmart_my_account_side_login_form_redirect', function () {
       return get_permalink( '9255' );
    });

    Kind Regards

Viewing 2 posts - 1 through 2 (of 2 total)