Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Keep users from /wp-admin

@mvaneijgen

Participant

This works

// hook failed login
add_action('wp_login_failed', 'my_front_end_login_fail'); 
 
function my_front_end_login_fail($username){
    // Get the reffering page, where did the post submission come from?
    $referrer = $_SERVER['HTTP_REFERER'];
 
    // if there's a valid referrer, and it's not the default log-in screen
    if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){
        // let's append some information (login=failed) to the URL for the theme to use
        wp_redirect($referrer . '?login=failed'); 
    exit;
    }
}

http://www.wpinsite.com/code-snippets/how-to-redirect-wordpress-failed-logins

Skip to toolbar