Create a login script for WordPress

  time(),
        'user_email'  =>  $email_address,
        'first_name'  =>  $first_name,
        'last_name'  => $last_name,
        'user_pass'   =>  $password  // When creating an user, `user_pass` is expected.
    );
    
    $user_id = wp_insert_user( $user_data ) ;
    update_user_meta($user_id, 'subscribe_status', $subscribe_status);
    
    //On Success
    if ( ! is_wp_error( $user_id ) ) {
        $response['status'] = 'success';
        wp_set_auth_cookie($user_id);
    }else{
        $response['status'] = 'failed';
    }
    
endif;

Leave a Reply

Your email address will not be published. Required fields are marked *