Skip to:
Content
Pages
Categories
Search
Top
Bottom

Stop redirecting to the WP login page?

  • Avatar of cmccarra
    cmccarra
    Participant

    @connor-mccarra

    Hi All,

    When a user incorrectly types a password or username they are redirected the wp-login page where they are told they have entered the wrong details and to try and login again. Is there anyway to stop this redirection, and just tell the user they have incorrectly entered their login details on the homepage and keep them on the homepage login? Code edits?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of ozgirl57
    ozgirl57
    Participant

    @ozgirl57

    I just had the same problem and fixed it this way. I don’t know if this is the right way to do it, but it seems to work for me.

    Find your login form. Mine is located in my sidebar.php file. The first line of the form should look like this

    <form name=”login-form” id=”sidebar-login-form” class=”standard-form” action=”<?php echo site_url( ‘wp-login.php’, ‘login’ ) ?>”

    Where it says

    action=<?php echo site_url( ‘wp-login.php’, ‘login’ ) ?>”

    I just deleted wp-login.php, so now the line looks like this

    <form name=”login-form” id=”sidebar-login-form” class=”standard-form” action=”<?php echo site_url( ”, ‘login’ ) ?>”

    Now when someone enters the wrong info the page simply refreshes and the form clears, instead of sending them to the wp-login form page. You could also create a new file with some information or instruction and insert the filename so that it looks something like this

    <?php echo site_url( ‘thenameofyourfile.php’, ‘login’ ) ?>

    and then the user will be redirected to that file.

    Avatar of Gene53
    Gene53
    Participant

    @gene53

    @ozgirl57 Thanks, I’ll give that a try.

    BTW, could <?php echo site_url( ‘thenameofyourfile.php’, ‘login’ ) ?> be used to simply display a message such as “Oops, you have entered an incorrect username or password, please try again” in a page (instead of a PHP file) and change the ‘thenameofyourfile.php’ to the page slug?

    Thanks,

    Gene

    Avatar of Gene53
    Gene53
    Participant

    @gene53

    Hmm, how do I get my page slug inside <?php echo site_url( ‘thenameofyourfile.php’, ‘login’ ) ?> to replace thenameofyourfile.php?

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.