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

Is there anyway to get the password string from the login form?

share|improve this question
It would be a huge security hole if there were. – vancoder Mar 27 '13 at 21:37
@vancoder, you would be right if the user was asking how to retrieve the unhashed password from the DB, but the plaintext is seen when the user initially sets their password. That's how any plugin that enforces a level of password security functions. – Dan Mar 27 '13 at 22:04
up vote 2 down vote accepted

this should do the job, just add it to functions.php or put in a plugin:

add_filter( 'wp_authenticate_user', 'my_authenticate_user', 10, 2 );

function my_authenticate_user( $user, $password ) {

    // do whatever you want with the $password variable here

    return $user;

share|improve this answer
thanks a lot. it works perfectly :) – тнє Sufi Mar 27 '13 at 22:22
just out of curiosity, what are you using it for? – Simon Blackbourn Mar 27 '13 at 22:29
Well, it does get the password from the login form, but does not get the password string, when someone updates their password. Any idea how to get that? I mainly need the password from the update profile form. I need to send this passowrd string to an external API, to update password for that user in an external system at the same time. – тнє Sufi Mar 27 '13 at 22:42
the only way i can see to do this is to hook into the user_profile_update_errors action (line 153 of wp-admin/includes/user.php). the plaintext password is stored in $user->user_pass (if it has been set), but you'll need to check that there are no password errors. – Simon Blackbourn Mar 27 '13 at 23:15

Look at the form markup:

<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" />

So $_POST['pwd'] is the password.

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.