Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#50880 closed enhancement (wontfix)

Allow wpmu_create_user to return a WP_Error

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Users Keywords: good-first-bug has-patch
Focuses: multisite Cc:


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.

Change History (2)

This ticket was mentioned in PR #463 on WordPress/wordpress-develop by mikeyhoward1977.

4 years ago

  • Keywords has-patch added; needs-patch removed

Return WP_Error object on failure from wpmu_create_user()

Trac ticket:

#2 @johnbillion
4 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

As per discussion on Slack, let's forget about changing this.

Note: See TracTickets for help on using tickets.