Support » Fixing WordPress » opening login form as pop-up

  • I am using this function to redirect login page to my desired page in wordpress. I have pasted this code in my theme’s functions.php file

    function custom_login_page() {
     $new_login_page_url = home_url( '/login-2/' ); // new login page
     global $pagenow;
     if( $pagenow == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
        wp_redirect($new_login_page_url);
       //($new_login_page_url);
        exit;
     }
    }
    
    if(!is_user_logged_in()){
     add_action('init','custom_login_page');
    } 

    Now it is redirecting properly , but i am not getting how to open it as pop-up window? is there anyway i can do it in this function itself??

    I tried doing
    `if( $pagenow == “wp-login.php” && $_SERVER[‘REQUEST_METHOD’] == ‘GET’) {
    $link = “<script>window.open($new_login_page_url, ‘width=710,height=555,left=160,top=170’)</script>”;

    echo $link;
    exit;`

    but it did nit work. Please suggest.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.