I'm building an application for a client that is accessed via an email address and a project number - a custom field.

I created a really simple form from scratch (i.e. not using wp_login_form), and I validate the posted values with WP_QUERY.

My problem is that when the form values are incorrect, or blank, the user is being automatically redirected to the wp-login.php page.

How can I override this behavior and keep the user on the custom log-in page template?

    <form action="<?php the_permalink(); ?>" method="post">
        <label for="form_email">Email Address:</label>
            <input id="form_email" type="text" name="email" value="" />
        <label for="form_project">Project Number:</label>
            <input id="form_project" type="text" name="project" value="" />
        <input type="submit" name="submit" value="Submit" />

2 Answers 2


This has been covered quite thoroughly here:


I've linked directly to the most informative and complete answer of the group (IMO).

  • The question you linked to (like almost all that I read prior to posting my question) deals with overriding the default behavior of the wp_login_form() function, which I'm not using. Any idea if the processes outlined there would still be valid?
    – MarketHubb
    Oct 3, 2015 at 23:10
  • Yes, only part of the answer I highlighted deals with the wp_login_form() helper. The hooks and custom helpers defined in that answer modify other aspects of the process which are not specific to the native login form.
    – dswebsme
    Oct 4, 2015 at 3:12

If you want to customize it through coding then this tutorial is surely gonna help you. You can easily replace default WordPress login page with your own custom login page.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.