[wp-trac] [WordPress Trac] #63770: WordPress wp_insert_user() throws warning when password is not provided

WordPress Trac noreply at wordpress.org
Thu Jul 31 04:53:59 UTC 2025


#63770: WordPress wp_insert_user() throws warning when password is not provided
---------------------------------------+-------------------------------
 Reporter:  sheldorofazeroth           |       Owner:  sheldorofazeroth
     Type:  defect (bug)               |      Status:  assigned
 Priority:  normal                     |   Milestone:  Awaiting Review
Component:  Login and Registration     |     Version:  trunk
 Severity:  normal                     |  Resolution:
 Keywords:  needs-patch has-test-info  |     Focuses:
---------------------------------------+-------------------------------

Comment (by rollybueno):

 There's no check in place to see if the `user_pass` key exists in
 `$userdata`. It only assume it exists by default. If we intend to make it
 required, we should add a check and throw WP_Error in case it's missing.

 Replying to [comment:2 dd32]:
 > The `user_pass` is a required parameter of `wp_insert_user()` at
 present. It's not optional, nor is it defaulting to a random password.
 >
 > > In this case, WordPress correctly generates a random password for the
 user.
 >
 > This functionality is not part of `wp_insert_user()`, instead this is
 part of `register_new_user()` which does not allow specifying the user's
 password.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63770#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list