0

I am trying to catch the username and the new password to update it on the backup server. I need to fetch $new_pass but the password always returns null.

add_action( 'password_reset', 'remote_password_update' );
function remote_password_update( $user, $new_pass ) {

        $username = $user->user_login; //THIS WORKS PERFECTLY
        $password = $new_pass; //THIS ALWAYS RETURNS NULL

}

This is pretty basic and straight forward, so I am not sure what the problem is. Any help is highly appreciated!

0

Note that:

add_action( 'password_reset', 'remote_password_update' );

is like calling:

add_action( 'password_reset', 'remote_password_update', 10, 1 );

where 10 is the default priority and 1 is the number of arguments.

You need:

add_action( 'password_reset', 'remote_password_update', 10, 2 );

with 2 as the number of arguments. Now you should be able to access the $new_pass input variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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