i am using custom login page, when i click on sign in its redirect to login=blank

I am using custom login page and its redirecting to login=blank, and also anyone tell me about how can registration with newsletter. Kindly anyone tell me how can i get ride from it. below i put all code.

$page_name = "";
$product_pages_args = array(
    'meta_key' => '_wp_page_template',
    'meta_value' => 'login.php'
);

$product_pages = get_pages( $product_pages_args );
foreach ( $product_pages as $product_page ) {
    $page_id.= $product_page->ID;
}

function goto_login_page() {

global $page_id;
$login_page = home_url( '/?page_id='. $page_id. '/' );
$page = basename($_SERVER['REQUEST_URI']);
    if( $page == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
        wp_redirect($login_page);
        exit;
    }
}
add_action('init','goto_login_page');

function login_failed() {
    global $page_id;
    $login_page = home_url( '/?page_id='. $page_id. '/' );
    wp_redirect( $login_page . '&login=failed' );
    exit;
}
add_action( 'wp_login_failed', 'login_failed' );

function blank_username_password( $user, $username, $password ) {
    global $page_id;
    $login_page = home_url( '/?page_id='. $page_id. '/' );
    if( $username == "" || $password == "" ) {
        wp_redirect( $login_page . "&login=blank" );
    exit;
    }
}
add_filter( 'authenticate', 'blank_username_password', 1, 3);

echo $login_page = $page_path ;

function logout_page() {
    global $page_id;
    $login_page = home_url( '/?page_id='. $page_id. '/' );
    wp_redirect( $login_page . "&login=false" );
    exit;
}
add_action('wp_logout', 'logout_page');

and login page code is
<?php
  $args = array(
  'redirect' => home_url(),
  'id_usern' => 'email',
  'id_password' => 'pass',
  )
;?>
<?php wp_login_form( $args ); ?>

Related posts