WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use this simple HTML loginform in my sidebar. Does anyone have any clever way to make it show the errormessages when you type in wrong password or username?

<form action="<?php echo wp_login_url(get_permalink()); ?>" method="post">
<input type="text" name="log" id="log" style="width:92%; margin-bottom:3px;" value="Username" onfocus="if(this.value=='Username')this.value=''" onblur="if(this.value=='')this.value='Username'" />
<input type="password" name="pwd" id="pwd" style="width:92%; margin-bottom:3px;" value="Password" onfocus="if(this.value=='Password')this.value=''" onblur="if(this.value=='')this.value='Password'" />
<input type="submit" name="submit" class="button" value="Login" />
share|improve this question

Why do you not use the default function wp_login_form() for the login form, example:

global $user_login;

if (is_user_logged_in()) {
    echo __( 'Hello', 'theme_text_domain' ) . $user_login . '<a href="' . wp_logout_url() . '" title="' . __( 'Logout', 'theme_text_domain' ) . '">' . __( 'Logout', FB_BASIS_TEXTDOMAIN ) . '</a>';
} else {

the function and his params, more information on the codex

    'echo' => true,
    'redirect' => site_url($_SERVER['REQUEST_URI']), 
    'form_id' => 'loginform',
    'label_username' => __('Username'),
    'label_password' => __('Password'),
    'label_remember' => __('Remember Me'),
    'label_log_in' => __('Log In'),
    'id_username' => 'user_login',
    'id_password' => 'user_pass',
    'id_remember' => 'rememberme',
    'id_submit' => 'wp-submit',
    'remember' => true,
    'value_username' => ,
    'value_remember' => false
share|improve this answer
this form just redirects to /wp-login.php to show error message. What I´m trying to do is get the errormessage directly above the form – Demilio Sep 11 '12 at 13:17
the function have the param redirect and you can set a adress, as example the current site, where you login: 'redirect' => site_url($_SERVER['REQUEST_URI']), – bueltge Sep 11 '12 at 14:33
yes, but the messages are still not showing, but I managed to make a page with a custom "login error" text on it, but the best solution would be to include a small message right above the loginform or something. But thanks for the help so far – Demilio Sep 12 '12 at 11:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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