[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:21:20 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:
 Severity:  major                   |   Keywords:  needs-patch
  Focuses:                          |
------------------------------------+------------------------------
 The wp_insert_user() function in WordPress allows creating a user without
 explicitly providing a password. In this case, WordPress correctly
 generates a random password for the user. However, it still produces the
 following warning:

 {{{
 PHP Warning: Undefined array key "user_pass" in wp-includes\user.php on
 line 2219
 }}}

 Fix to this would be Either:
 Make the password parameter mandatory for wp_insert_user(), OR Add proper
 validation to handle cases when password is not provided to prevent the
 warning

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


More information about the wp-trac mailing list