WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Send visitor to a different page if their login fails? (3 posts)

  1. alkafy
    Member
    Posted 6 years ago #

    Hello,

    I have a login box in my sidebar that works beautifully thus far. However, I'd like to redirect users to a different page (instead of wp-login.php) when they enter their username or password incorrectly. The sidebar code is as follows:

    <form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
    
    <div id="reg_or_login">
    	<a href="<?php bloginfo('url') ?>/register">Register</a> or Log in:
    </div>
    
    <div id="user_prompt">
    	Username: <label for="log"><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="13" /> </label>
    </div>
    
    <div id="pwd_prompt">
    	Password: <label for="pwd"><input type="password" name="pwd" id="pwd" size="13" /> </label>
    
    	<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
    </div>
    
    <div style="display: inline;" class="buttons">
    	<button type="submit" style="font-size: 1em; display: inline; float: none;" class="">
    		<img src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/group_key.png" alt=""/>
    Login
    	</button>
    </div>
    
    <div id="lost_pwd">
    	<a href="<?php bloginfo('url') ?>/lost-password">Lost Password?</a>
    </div>
    
    <div class="breakfree"></div>
    </form>

    I've struggled with this for quite a while now, so any help at all would greatly be appreciated!

  2. haochi
    Member
    Posted 6 years ago #

    You will have to edit wp-login.php

  3. alkafy
    Member
    Posted 6 years ago #

    I was hoping not to modify the core, but I'm open to it if there's no other option. Anyone know if it could be done by feeding wp-login to another page with ob_start and ob_end_flush and point the sidebar form action to that page? I just started with php so I've only got a vague idea of how it might be accomplished that way.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.