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'm designing a custom login template and I need a way to access the <input> html so I can add a label inside the input. I understand the use of wp_login_form() but that only lets me set the default lables outside the input to blank. I need to add the onfocus and onblur attributes to the html. Any ideas?

share|improve this question
up vote 1 down vote accepted

There's this basic trick: Close brackets, open again, insert what you need, close again.

Real life example:

$args = array( 
    // some args for the login form
    'value_username' => 'User Name" onBlur="whatever" onFocus="anotherfoo';
wp_login_form( $args );

So we closed the brackets after the Username, then added our additional attributes and left the quotes open at the end, so the wp_login_form() function can then close it by itself.

share|improve this answer

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.