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

Im creating a simple login/registration page incorporating user moderation and bootstrapping wp for the heavy lifting.

I can get the new user added to the db and a password gets created and hashed and all, but when i go to login w/ that account the password won't work. i'm stumped...

Anyone see anything i'm missing?

require_once( ABSPATH . WPINC . '/registration.php' );
$user_pass = wp_generate_password();
$userdata = array(
  'user_pass' => $user_pass,
  'user_login' => esc_attr( $_POST['user_email'] ),
  'user_email' => esc_attr( $_POST['user_email'] ),

if( !$userdata['user_login'] )
  $error .= __('An Email Address is required for registration.', 'frontendprofile');
elseif ( username_exists( $userdata['user_login'] ) )
  $error .= __('Sorry, that Email Address is already in use for another account.', 'frontendprofile');
elseif ( !is_email( $userdata['user_email'] ) )
  $error .= __('You must enter a valid Email Address.', 'frontendprofile');
elseif ( email_exists( $userdata['user_email'] ) )
  $error .= __('Sorry, that Email Address is already for another account.', 'frontendprofile');

  $new_user = wp_update_user( $userdata );

thanks in advance,

share|improve this question
up vote 1 down vote accepted

Got it. Cant use wp_update_user for new addition i guess.

need to use:

wp_create_user( $userdata['user_login'], $userdata['user_pass'], $userdata['user_email'] );
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.