0

I'm running the WordPress instance on MAMP.

Everything works fine if I try to login using wp-admin page; however, I'm trying to login using a custom page with the wp_login_form(). Custom login page url is http://localhost:8888/wpsb/login/

  • When I login using proper credentials, it logs in fine.
  • When I click the submit button without filling in one of the fields, it's fine. (Redirects me with "?login=failed".

Those are fine. The problem is that when I try to login using wrong credentials, it sends me to http://localhost/wpsb/login/?login=failed and shows up as "This webpage is not available". I noticed the port from the localhost is removed, but I can't seem to understand what the problem is.

Page Template Code:

 <?php
 /*
 Template Name: Login
 */
 ?>

   <?php get_header(); ?>

        <div id="content">

            <div id="inner-content" class="wrap cf">

                <div id="main" class="m-all t-all d-all last-col cf" role="main">

                    <article id="post-<?php the_ID(); ?>" <?php post_class( 'cf' ); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">

                        <section class="entry-content cf" itemprop="articleBody">

                            <h2><?php _e( 'Login', 'woocommerce' ); ?></h2>

                            <?php wp_login_form(); ?> 

                        </section>

                        <section class="entry-content cf" itemprop="articleBody">

                            <h2><?php _e( 'Register', 'woocommerce' ); ?></h2>

                            <form method="post" class="register">

                                <?php do_action( 'woocommerce_register_form_start' ); ?>

                                <p class="form-row form-row-wide">
                                    <label for="reg_email"><?php _e( 'Email Address', 'woocommerce' ); ?></label>
                                    <input type="email" class="input-text" name="email" id="reg_email" value="<?php if ( ! empty( $_POST['email'] ) ) echo esc_attr( $_POST['email'] ); ?>" />
                                </p>

                                <p class="form-row form-row-wide">
                                    <label for="reg_password"><?php _e( 'Password', 'woocommerce' ); ?></label>
                                    <input type="password" class="input-text" name="password" id="reg_password" />
                                </p>

                                <!-- Spam Trap -->
                                <div style="<?php echo ( ( is_rtl() ) ? 'right' : 'left' ); ?>: -999em; position: absolute;"><label for="trap"><?php _e( 'Anti-spam', 'woocommerce' ); ?></label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>

                                <?php do_action( 'woocommerce_register_form' ); ?>

                                <p class="form-row">
                                    <?php wp_nonce_field( 'woocommerce-register', 'register' ); ?>
                                    <input type="submit" class="button" name="register" value="<?php _e( 'Register', 'woocommerce' ); ?>" />
                                </p>

                                <?php do_action( 'woocommerce_register_form_end' ); ?>

                            </form>

                        </section>

                    </article>

                </div>

            </div>

        </div>

   <?php get_footer(); ?>
  • Will be very hard to help you if you can't show the code. – Mark Kaplun Oct 14 '14 at 20:19
  • It's just a simple wp_login_form(), but I'll add the code of the page template, too. I've got the same login form in the footer, in the header, and in the body of the page. (they all turn into plugins once the user logs in, except for the one in the body) – yaharga Oct 14 '14 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.