[wp-trac] [WordPress Trac] #50880: Allow wpmu_create_user to return a WP_Error

WordPress Trac noreply at wordpress.org
Mon Aug 10 09:42:36 UTC 2020


#50880: Allow wpmu_create_user to return a WP_Error
-------------------------+----------------------------------------
 Reporter:  johnbillion  |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Future Release
Component:  Users        |    Version:  3.0
 Severity:  normal       |   Keywords:  needs-patch good-first-bug
  Focuses:  multisite    |
-------------------------+----------------------------------------
 The `wpmu_create_user()` function calls `wp_create_user()` which returns a
 descriptive `WP_Error` object upon failure, but this error isn't passed on
 as the return value from `wpmu_create_user()` which instead returns
 boolean false.

 A `$wp_error` parameter should be added to `wpmu_create_user()` (similar
 to `wp_insert_post()`) in order to instruct the function to return the
 `WP_Error` object when there's a failure.

 This will allow, for example, WP-CLI to show a more descriptive error
 message when there is a failure when attempting to create a user on
 Multisite. Currently it has to show a generic `Unknown error creating new
 user` message.

 #21910 is related, but hasn't seen any movement in years, so for now let's
 add this parameter.

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


More information about the wp-trac mailing list